aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLeo Famulari <leo@famulari.name>2016-07-22 18:57:40 -0400
committerLeo Famulari <leo@famulari.name>2016-07-22 18:58:31 -0400
commitd227260d2f7833b6bdc55b8e3792378626ef3b69 (patch)
tree26d47d5d8ee8efb102323bca215429a8f8fe1095 /tests
parentd778fa5ff6f4a860919eaf13db3f84cfc68cbee8 (diff)
parent26ad4adb5568c6ff370f446431b079520fb09615 (diff)
downloadguix-d227260d2f7833b6bdc55b8e3792378626ef3b69.tar
guix-d227260d2f7833b6bdc55b8e3792378626ef3b69.tar.gz
Merge branch 'master' into core-updates
Resolved conflicts: * gnu/packages/scheme.scm: Conflict in import of (guix licenses). On master, "#:hide (openssl)" was used. On core-updates, "#:select (some licenses)" was used. The latter won the conflict. * gnu/packages/version-control.scm (git)[arguments]: Whitespace conflict in 'install-shell-completion.
Diffstat (limited to 'tests')
-rw-r--r--tests/guix-system.sh4
-rw-r--r--tests/publish.scm34
2 files changed, 36 insertions, 2 deletions
diff --git a/tests/guix-system.sh b/tests/guix-system.sh
index d9e1679ae7..77d4e28999 100644
--- a/tests/guix-system.sh
+++ b/tests/guix-system.sh
@@ -1,5 +1,5 @@
# GNU Guix --- Functional package management for GNU
-# Copyright © 2014, 2015 Ludovic Courtès <ludo@gnu.org>
+# Copyright © 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
#
# This file is part of GNU Guix.
#
@@ -139,7 +139,7 @@ if guix system build "$tmpfile" 2> "$errorfile"
then
exit 1
else
- grep "service 'buggy!'.*'does-not-exist'.*undefined" "$errorfile"
+ grep "service 'buggy!'.*'does-not-exist'.*not provided" "$errorfile"
fi
# Reporting inconsistent user accounts.
diff --git a/tests/publish.scm b/tests/publish.scm
index 9bf181f1fc..0ba33487bd 100644
--- a/tests/publish.scm
+++ b/tests/publish.scm
@@ -26,6 +26,8 @@
#:use-module (guix utils)
#:use-module (guix hash)
#:use-module (guix store)
+ #:use-module (guix derivations)
+ #:use-module (guix gexp)
#:use-module (guix base32)
#:use-module (guix base64)
#:use-module ((guix records) #:select (recutils->alist))
@@ -210,4 +212,36 @@ References: ~%"
(display "This file is not a valid store item." port)))
(response-code (http-get (publish-uri (string-append "/nar/invalid"))))))
+(test-equal "/file/NAME/sha256/HASH"
+ "Hello, Guix world!"
+ (let* ((data "Hello, Guix world!")
+ (hash (call-with-input-string data port-sha256))
+ (drv (run-with-store %store
+ (gexp->derivation "the-file.txt"
+ #~(call-with-output-file #$output
+ (lambda (port)
+ (display #$data port)))
+ #:hash-algo 'sha256
+ #:hash hash)))
+ (out (build-derivations %store (list drv))))
+ (utf8->string
+ (http-get-body
+ (publish-uri
+ (string-append "/file/the-file.txt/sha256/"
+ (bytevector->nix-base32-string hash)))))))
+
+(test-equal "/file/NAME/sha256/INVALID-NIX-BASE32-STRING"
+ 404
+ (let ((uri (publish-uri
+ "/file/the-file.txt/sha256/not-a-nix-base32-string")))
+ (response-code (http-get uri))))
+
+(test-equal "/file/NAME/sha256/INVALID-HASH"
+ 404
+ (let ((uri (publish-uri
+ (string-append "/file/the-file.txt/sha256/"
+ (bytevector->nix-base32-string
+ (call-with-input-string "" port-sha256))))))
+ (response-code (http-get uri))))
+
(test-end "publish")