aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am3
-rw-r--r--tests/mock-inferior.scm45
2 files changed, 47 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am
index b0ab4ce..f9d6062 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -57,7 +57,8 @@ SOURCES = \
guix-data-service/web/query-parameters.scm \
guix-data-service/web/util.scm \
guix-data-service/web/view/html.scm \
- tests/driver.scm
+ tests/driver.scm \
+ tests/mock-inferior.scm
TEST_EXTENSIONS = .scm
diff --git a/tests/mock-inferior.scm b/tests/mock-inferior.scm
new file mode 100644
index 0000000..6424cd9
--- /dev/null
+++ b/tests/mock-inferior.scm
@@ -0,0 +1,45 @@
+(define-module (tests mock-inferior)
+ #:use-module (guix records)
+ #:use-module (guix tests)
+ #:export (<mock-inferior-package>
+ mock-inferior-package
+ mock-inferior-package?
+ mock-inferior-package-name
+ mock-inferior-package-version
+ mock-inferior-package-synopsis
+ mock-inferior-package-description
+ mock-inferior-package-home-page
+
+ with-mock-inferior-packages))
+
+(define-record-type* <mock-inferior-package>
+ mock-inferior-package make-mock-inferior-pacakge
+ mock-inferior-package?
+ (name mock-inferior-package-name)
+ (version mock-inferior-package-version)
+ (synopsis mock-inferior-package-synopsis)
+ (description mock-inferior-package-description)
+ (home-page mock-inferior-package-home-page))
+
+(define (with-mock-inferior-packages f)
+ (mock
+ ((guix inferior)
+ inferior-package-name
+ mock-inferior-package-name)
+ (mock
+ ((guix inferior)
+ inferior-package-version
+ mock-inferior-package-version)
+ (mock
+ ((guix inferior)
+ inferior-package-synopsis
+ mock-inferior-package-synopsis)
+ (mock
+ ((guix inferior)
+ inferior-package-description
+ mock-inferior-package-description)
+ (mock
+ ((guix inferior)
+ inferior-package-home-page
+ mock-inferior-package-home-page)
+ (f)))))))