aboutsummaryrefslogtreecommitdiff
path: root/tests/model-package-metadata.scm
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2019-05-12 17:01:51 +0100
committerChristopher Baines <mail@cbaines.net>2019-05-12 18:08:17 +0100
commit8eac26b17d996e3e171c92e43536333daf72b7c9 (patch)
tree72cd6fdf496b4bb5b1c21713fe4395d0dc429623 /tests/model-package-metadata.scm
parent0ab1c71722e81404972f80c91c9717e429d03ec3 (diff)
downloaddata-service-8eac26b17d996e3e171c92e43536333daf72b7c9.tar
data-service-8eac26b17d996e3e171c92e43536333daf72b7c9.tar.gz
Remove the sha1_hash from the package_metadata table
I'm thinking about adding more fields to this table, and the sha1_hash values will make this tricker. Therefore, remove the value, and adjust the existing code to cope. This commit also adds a new test which coveres some of the changed functionality.
Diffstat (limited to 'tests/model-package-metadata.scm')
-rw-r--r--tests/model-package-metadata.scm37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/model-package-metadata.scm b/tests/model-package-metadata.scm
new file mode 100644
index 0000000..4c2bc8e
--- /dev/null
+++ b/tests/model-package-metadata.scm
@@ -0,0 +1,37 @@
+(define-module (test-model-package-metadata)
+ #:use-module (ice-9 match)
+ #:use-module (srfi srfi-64)
+ #:use-module (tests mock-inferior)
+ #:use-module (guix-data-service database))
+
+(test-begin "test-model-package-metadata")
+
+(define mock-inferior-package-foo
+ (mock-inferior-package
+ (name "foo")
+ (version "2")
+ (synopsis "Foo")
+ (description "Foo description")
+ (home-page "https://example.com")))
+
+(with-mock-inferior-packages
+ (lambda ()
+ (use-modules (guix-data-service model package)
+ (guix-data-service model git-repository)
+ (guix-data-service model guix-revision)
+ (guix-data-service model package-metadata))
+
+ (with-postgresql-connection
+ (lambda (conn)
+ (test-assert "inferior-packages->package-metadata-ids"
+ (with-postgresql-transaction
+ conn
+ (lambda (conn)
+ (match
+ (inferior-packages->package-metadata-ids
+ conn
+ (list mock-inferior-package-foo))
+ ((x) (string? x))))
+ #:always-rollback? #t))))))
+
+(test-end)