aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanjela Lura <danielaluraa@gmail.com>2020-06-19 14:16:05 +0200
committerChristopher Baines <mail@cbaines.net>2020-06-19 16:03:32 +0100
commit9e93b2b3a8450ff9bc08ec4ca61bde925f1378d7 (patch)
tree271f1dcabe19f195f3076f8ac5faaca6b1e96e88
parent365bf27838d3997c97ab2c4a77905a5e3b20d867 (diff)
downloaddata-service-9e93b2b3a8450ff9bc08ec4ca61bde925f1378d7.tar
data-service-9e93b2b3a8450ff9bc08ec4ca61bde925f1378d7.tar.gz
Fix the test-model-package-metadata test
Signed-off-by: Christopher Baines <mail@cbaines.net>
-rw-r--r--tests/model-package-metadata.scm83
1 files changed, 46 insertions, 37 deletions
diff --git a/tests/model-package-metadata.scm b/tests/model-package-metadata.scm
index cc66aae..2b97465 100644
--- a/tests/model-package-metadata.scm
+++ b/tests/model-package-metadata.scm
@@ -39,45 +39,54 @@
(inferior-packages->license-set-ids conn license-id-lists)))
-(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))
+(mock
+ ((guix-data-service model package-metadata)
+ inferior-packages->translated-package-descriptions-and-synopsis
+ (lambda (inferior inferior-package)
+ (cons `(("en_US.utf8" . "Fake synopsis"))
+ `(("en_US.utf8" . "Fake description")))))
+ (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
- "test-model-package-metadata"
- (lambda (conn)
- (check-test-database! conn)
+ (with-postgresql-connection
+ "test-model-package-metadata"
+ (lambda (conn)
+ (check-test-database! 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
- mock-inferior-package-foo-2)
- (test-license-set-ids conn))
- ((x) (number? x))))
- #:always-rollback? #t))
+ (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
+ mock-inferior-package-foo-2)
+ (test-license-set-ids conn))
+ ((x) (number? x))))
+ #:always-rollback? #t))
- (with-postgresql-transaction
- conn
- (lambda (conn)
- (test-equal "inferior-packages->package-metadata-ids"
- (inferior-packages->package-metadata-ids
- conn
- (list mock-inferior-package-foo
- mock-inferior-package-foo-2)
- (test-license-set-ids conn))
- (inferior-packages->package-metadata-ids
- conn
- (list mock-inferior-package-foo
- mock-inferior-package-foo-2)
- (test-license-set-ids conn)))
- #:always-rollback? #t))))))
+ (with-postgresql-transaction
+ conn
+ (lambda (conn)
+ (test-equal "inferior-packages->package-metadata-ids"
+ (inferior-packages->package-metadata-ids
+ conn
+ ""
+ (list mock-inferior-package-foo
+ mock-inferior-package-foo-2)
+ (test-license-set-ids conn))
+ (inferior-packages->package-metadata-ids
+ conn
+ ""
+ (list mock-inferior-package-foo
+ mock-inferior-package-foo-2)
+ (test-license-set-ids conn)))
+ #:always-rollback? #t)))))))
(test-end)