aboutsummaryrefslogtreecommitdiff
path: root/tests/publish.scm
diff options
context:
space:
mode:
authorLeo Famulari <leo@famulari.name>2016-06-12 22:02:04 -0400
committerLeo Famulari <leo@famulari.name>2016-06-12 22:09:26 -0400
commitee86e7e14859533045e1f7727ae731ba6ba72daf (patch)
treea5f51a9c4859a3242b46876797b98e77a5a7506e /tests/publish.scm
parent8af5cac527eee03005f3809578a0d8258a878f95 (diff)
parentfe585be9aa8f5158a7dfb6477d19ece3d643dec3 (diff)
downloadguix-ee86e7e14859533045e1f7727ae731ba6ba72daf.tar
guix-ee86e7e14859533045e1f7727ae731ba6ba72daf.tar.gz
Merge branch 'master' into core-updates
Diffstat (limited to 'tests/publish.scm')
-rw-r--r--tests/publish.scm45
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/publish.scm b/tests/publish.scm
index 6645286f5a..d6d537c58a 100644
--- a/tests/publish.scm
+++ b/tests/publish.scm
@@ -30,12 +30,14 @@
#:use-module (guix base64)
#:use-module ((guix serialization) #:select (restore-file))
#:use-module (guix pk-crypto)
+ #:use-module (web uri)
#:use-module (web client)
#:use-module (web response)
#:use-module (rnrs bytevectors)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-26)
#:use-module (srfi srfi-64)
+ #:use-module (ice-9 format)
#:use-module (ice-9 match)
#:use-module (ice-9 rdelim))
@@ -101,6 +103,37 @@ References: ~a~%"
(publish-uri
(string-append "/" (store-path-hash-part %item) ".narinfo")))))
+(test-equal "/*.narinfo with properly encoded '+' sign"
+ ;; See <http://bugs.gnu.org/21888>.
+ (let* ((item (add-text-to-store %store "fake-gtk+" "Congrats!"))
+ (info (query-path-info %store item))
+ (unsigned-info
+ (format #f
+ "StorePath: ~a
+URL: nar/~a
+Compression: none
+NarHash: sha256:~a
+NarSize: ~d
+References: ~%"
+ item
+ (uri-encode (basename item))
+ (bytevector->nix-base32-string
+ (path-info-hash info))
+ (path-info-nar-size info)))
+ (signature (base64-encode
+ (string->utf8
+ (canonical-sexp->string
+ ((@@ (guix scripts publish) signed-string)
+ unsigned-info))))))
+ (format #f "~aSignature: 1;~a;~a~%"
+ unsigned-info (gethostname) signature))
+
+ (let ((item (add-text-to-store %store "fake-gtk+" "Congrats!")))
+ (utf8->string
+ (http-get-body
+ (publish-uri
+ (string-append "/" (store-path-hash-part item) ".narinfo"))))))
+
(test-equal "/nar/*"
"bar"
(call-with-temporary-output-file
@@ -112,6 +145,18 @@ References: ~a~%"
(call-with-input-string nar (cut restore-file <> temp)))
(call-with-input-file temp read-string))))
+(test-equal "/nar/ with properly encoded '+' sign"
+ "Congrats!"
+ (let ((item (add-text-to-store %store "fake-gtk+" "Congrats!")))
+ (call-with-temporary-output-file
+ (lambda (temp port)
+ (let ((nar (utf8->string
+ (http-get-body
+ (publish-uri
+ (string-append "/nar/" (uri-encode (basename item))))))))
+ (call-with-input-string nar (cut restore-file <> temp)))
+ (call-with-input-file temp read-string)))))
+
(test-equal "/nar/invalid"
404
(begin