aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2022-05-05 21:40:17 -0400
committerKyle Meyer <kyle@kyleam.com>2022-05-07 10:09:26 -0400
commit2bf9c383b2943eef1754e20db24419f8e269a8b7 (patch)
tree4b2d8747cde49678e455203719fdcee466550b1b /tests
parent6f196480a040c0f57bb0a11ecae97e5b427a9d0f (diff)
downloadpiem-2bf9c383b2943eef1754e20db24419f8e269a8b7.tar.gz
piem-inboxes: Support mapping inbox to multiple coderepos
An inbox may regularly receive patches for multiple repos. Allow an inbox's :coderepo to be a list, and teach piem-inbox-coderepo to select a target repo by prompting the caller with the configured list. Message-Id: <20220506014017.14259-1-kyle@kyleam.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/piem-tests.el29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/piem-tests.el b/tests/piem-tests.el
index 444ed5f..79d8591 100644
--- a/tests/piem-tests.el
+++ b/tests/piem-tests.el
@@ -49,6 +49,21 @@
dir = /code/foo/.git
")
+(defvar piem-tests-sample-pi-config-multiple-coderepos "
+[publicinbox \"foo\"]
+ address = foo@example.com
+ url = https://example.com/foo
+ inboxdir = /inboxes/foo
+ coderepo = foo.git
+ coderepo = bar.git
+
+[coderepo \"foo.git\"]
+ dir = /code/foo/.git
+
+[coderepo \"bar.git\"]
+ dir = /code/bar/.git
+")
+
(ert-deftest piem-merged-inboxes:from-config-disabled ()
(let ((piem-get-inboxes-from-config nil)
(piem-inboxes nil))
@@ -78,6 +93,20 @@
(piem-clear-merged-inboxes)
(should-not (piem-inbox-get :address "foo")))))
+(ert-deftest piem-merged-inboxes:from-config-multiple-coderepos ()
+ (piem-clear-merged-inboxes)
+ (let ((piem-get-inboxes-from-config t)
+ (piem-inboxes nil))
+ (piem-tests-with-pi-config piem-tests-sample-pi-config-multiple-coderepos
+ (cl-letf (((symbol-function 'completing-read)
+ (lambda (&rest _) "/code/foo")))
+ (should (equal (piem-inbox-coderepo "foo")
+ "/code/foo/")))
+ (cl-letf (((symbol-function 'completing-read)
+ (lambda (&rest _) "/code/bar")))
+ (should (equal (piem-inbox-coderepo "foo")
+ "/code/bar/"))))))
+
(ert-deftest piem-merged-inboxes:override-config ()
(piem-clear-merged-inboxes)
(let ((piem-get-inboxes-from-config t)