;;;; Copyright (C) 2020 Julien Lepiller ;;;; ;;;; This library is free software; you can redistribute it and/or ;;;; modify it under the terms of the GNU Lesser General Public ;;;; License as published by the Free Software Foundation; either ;;;; version 3 of the License, or (at your option) any later version. ;;;; ;;;; This library is distributed in the hope that it will be useful, ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; Lesser General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU Lesser General Public ;;;; License along with this library; if not, write to the Free Software ;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ;;;; (define-module (tests webfinger) #:use-module (ice-9 format) #:use-module (json) #:use-module (rnrs bytevectors) #:use-module (srfi srfi-64) #:use-module (webfinger webfinger)) (test-begin "webfinger") (define simple-record-scm '(("subject" . "acct:carol@example.com") ("links" . #((("rel" . "http://openid.net/specs/connect/1.0/issuer") ("href" . "https://openid.example.com")))))) (define simple-record (make-jrd-record "acct:carol@example.com" '() #f (list (make-link-record "http://openid.net/specs/connect/1.0/issuer" #f "https://openid.example.com" #f #f)))) (test-assert "simple example decode" (let ((converted-simple-record (json->jrd-record simple-record-scm))) (if (equal? converted-simple-record simple-record) #t (pk 'fail converted-simple-record #f)))) (test-assert "simple example encode" (let ((converted-simple-record-scm (jrd->string simple-record))) (if (equal? (scm->json-string simple-record-scm) converted-simple-record-scm) #t (pk 'fail converted-simple-record-scm #f)))) (test-end "webfinger")