aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus [a t] riseup [d o t] net>2023-04-21 16:06:12 +0200
committermarty hiatt <martianhiatus [a t] riseup [d o t] net>2023-04-21 16:06:12 +0200
commite13ffc1307e50f3b220a5e557dc6767bdc3d701a (patch)
tree122c384739bf29c889d1b413664b20b72b849ed3
parentd0b971aeafa71087f6b45cb78185eecd8faa8112 (diff)
actually fix report to mods tests
-rw-r--r--test/mastodon-tl-tests.el36
1 files changed, 17 insertions, 19 deletions
diff --git a/test/mastodon-tl-tests.el b/test/mastodon-tl-tests.el
index 0b8d3e3..e029ba7 100644
--- a/test/mastodon-tl-tests.el
+++ b/test/mastodon-tl-tests.el
@@ -1146,27 +1146,24 @@ correct value for following, as well as notifications enabled or disabled."
(ert-deftest mastodon-tl--report-to-mods-params-alist ()
""
(with-temp-buffer
- (let ((toot mastodon-tl-test-base-toot))
+ (let* ((toot mastodon-tl-test-base-toot)
+ (account (alist-get 'account toot)))
(with-mock
- (mock (mastodon-http--api "reports") => "https://instance.url/api/v1/reports")
- (mock (mastodon-tl--toot-or-base
- (mastodon-tl--property 'toot-json :no-move))
- => mastodon-tl-test-base-toot)
+ ;; no longer needed after our refactor
+ ;; (mock (mastodon-http--api "reports") => "https://instance.url/api/v1/reports")
+ ;; (mock (mastodon-tl--toot-or-base
+ ;; (mastodon-tl--property 'toot-json :no-move))
+ ;; => mastodon-tl-test-base-toot)
(mock (read-string "Add comment [optional]: ") => "Dummy complaint")
-
(stub y-or-n-p => nil) ; no to all
- (should (equal (mastodon-tl--report-params)
+ (should (equal (mastodon-tl--report-params account toot)
'(("account_id" . 42)
("comment" . "Dummy complaint")
("category" . "other"))))
(with-mock
(stub y-or-n-p => t) ; yes to all
(mock (mastodon-tl--read-rules-ids) => '(1 2 3))
- ;; (mock (y-or-n-p "Also report status at point? ") => t)
- ;; (mock (y-or-n-p "Forward to remote admin? ") => nil)
- ;; (mock (y-or-n-p "Cite a rule broken? ") => nil)
- ;; (mock (y-or-n-p "Spam? ") => nil)
- (should (equal (mastodon-tl--report-params)
+ (should (equal (mastodon-tl--report-params account toot)
'(("rule_ids[]" . 3)
("rule_ids[]" . 2)
("rule_ids[]" . 1)
@@ -1219,10 +1216,11 @@ correct value for following, as well as notifications enabled or disabled."
(ert-deftest mastodon-tl--read-rules ()
"Should return a list of string numbers based on `mastodon-tl--test-instance-rules'"
- (with-mock
- (stub mastodon-tl--instance-rules => mastodon-tl--test-instance-rules)
- (stub completing-read-multiple => '("We do not accept homophobia."
- "We do not accept harassment."
- "We also do not accept hate speech."))
- (should (equal '("2" "5" "6")
- (mastodon-tl--read-rules-ids)))))
+ (let ((crm-separator "[ ]*,[ ]*"))
+ (with-mock
+ (stub mastodon-tl--instance-rules => mastodon-tl--test-instance-rules)
+ (stub completing-read-multiple => '("We do not accept homophobia."
+ "We do not accept harassment."
+ "We also do not accept hate speech."))
+ (should (equal '("2" "5" "6")
+ (mastodon-tl--read-rules-ids))))))