[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/webpaste 87cee69 081/298: Added test for failover to the s
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/webpaste 87cee69 081/298: Added test for failover to the second provider and not random |
Date: |
Thu, 9 Dec 2021 18:59:49 -0500 (EST) |
branch: elpa/webpaste
commit 87cee69fe8f65f7dfc6d3192cdf24484941eeaa3
Author: Elis Axelsson <elis.axelsson@gmail.com>
Commit: Elis Axelsson <elis.axelsson@gmail.com>
Added test for failover to the second provider and not random
---
test/webpaste-test.el | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 52 insertions(+)
diff --git a/test/webpaste-test.el b/test/webpaste-test.el
index c677cf9..986589c 100644
--- a/test/webpaste-test.el
+++ b/test/webpaste-test.el
@@ -29,5 +29,57 @@
(should (string= returned-result "Works: test-string"))))
+(ert-deftest callback-from-working-provider-as-fallback ()
+ "This test sends a message to a bad provider that returns some error data.
+
+Then the bad provider pastes again like it should and we check that we got the
+result from the good provider only."
+
+ ;; Temporal storage for result
+ (let ((returned-result nil))
+ ;; Reset all webpaste variables
+ (setq-default webpaste-tested-providers nil)
+ (setq-default webpaste-provider-priority nil)
+
+ ;; Make two broken providers that "returns" the result by setting the
+ ;; variable and then failover.
+ ;; Also make two working providers that returns different messages so the
+ ;; test can detect which provider was used easily.
+ (setq-default webpaste-providers-alist
+ (list (list "brokenprovider1"
+ (lambda (text)
+ ;; Set return text
+ (setq returned-result
+ (concat "Broken1: " text))
+
+ ;; Call paste again
+ (webpaste-paste-text text)))
+
+ (list "workingprovider1"
+ (lambda (text)
+ (setq returned-result
+ (concat "Works1: " text))))
+
+ (list "workingprovider2"
+ (lambda (text)
+ (setq returned-result
+ (concat "Works2: " text))))
+
+ (list "brokenprovider2"
+ (lambda (text)
+ ;; Set return text
+ (setq returned-result
+ (concat "Broken2: " text))
+
+ ;; Call paste again
+ (webpaste-paste-text text)))))
+
+ ;; Call webpaste
+ (webpaste-paste-text "test-string")
+
+ ;; Check that we got the expected result
+ (should (string= returned-result "Works1: test-string"))))
+
+
(provide 'webpaste-test)
;;; webpaste-test.el ends here
- [nongnu] elpa/webpaste 8f37214 116/298: Update docs to match function, (continued)
- [nongnu] elpa/webpaste 8f37214 116/298: Update docs to match function, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 4dd2e1b 111/298: First test of creation of paste providers, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 0b67c54 117/298: Move code up to be defined before the webpaste-provider function, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste e11ce74 086/298: Refactor provider priority to own function, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste b2ffe99 091/298: Added emacs --version to output in build, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 993db7e 095/298: Added ptpb.pw as new and default provider, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 8861ed8 102/298: Added license-badge, renamed test-vars, stop providing webpaste-test, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste bdc204d 055/298: Autoload return function to always have it available, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 3e81264 067/298: Forgot call to retry sending on failure when refactoring to macro, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste f206653 074/298: Merge branch 'alphapapa-without-eval', ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 87cee69 081/298: Added test for failover to the second provider and not random,
ELPA Syncer <=
- [nongnu] elpa/webpaste dcc26da 084/298: Update melpa image links, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 6655ecc 085/298: Rename make compile to make build because it's easier to remember, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 346b5bc 087/298: Rename tests to be prefixed, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 3389b4a 089/298: Do not provide test-helper feature, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 7db5673 093/298: Added more emacs versions for tests, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 382e01d 105/298: Added page breaks to files, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste b7acc4e 100/298: Added test for returning of URL's, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 8027e6e 106/298: Run tests on emacs 25.2 since it's been released, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste e04d885 114/298: Add (prog1 nil ...) form to avoid having the nil hanging at the end, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 124ef8b 119/298: Drop usage of concat when returning link to users message field, ELPA Syncer, 2021/12/09