aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus [a t] riseup [d o t] net>2022-11-21 10:27:13 +0100
committermarty hiatt <martianhiatus [a t] riseup [d o t] net>2022-11-21 10:27:13 +0100
commit96829d0d1d61650bd5ee05d06dcb94ff764c2ca6 (patch)
tree684c648f11ad542f3631618830115361e7b95372
parentabbdef12e38c97e571ae8f664596fcf931cb4292 (diff)
fix toot del/pin tests
-rw-r--r--test/mastodon-toot-tests.el41
1 files changed, 22 insertions, 19 deletions
diff --git a/test/mastodon-toot-tests.el b/test/mastodon-toot-tests.el
index 9741964..b88510c 100644
--- a/test/mastodon-toot-tests.el
+++ b/test/mastodon-toot-tests.el
@@ -120,11 +120,12 @@ mention string."
"Should refuse to delete toot."
(let ((toot mastodon-toot-test-base-toot))
(with-mock
- (mock (mastodon-auth--user-acct) => "joebogus")
- ;; (mock (mastodon-toot--own-toot-p toot) => nil)
- (mock (mastodon-tl--property 'toot-json) => mastodon-toot-test-base-toot)
- (should (equal (mastodon-toot--delete-toot)
- "You can only delete (and redraft) your own toots.")))))
+ (mock (mastodon-auth--user-acct) => "joebogus")
+ ;; (mock (mastodon-toot--own-toot-p toot) => nil)
+ (mock (mastodon-tl--property 'toot-json) => mastodon-toot-test-base-toot)
+ (mock (mastodon-tl--property 'base-toot) => toot)
+ (should (equal (mastodon-toot--delete-toot)
+ "You can only delete (and redraft) your own toots.")))))
(ert-deftest mastodon-toot--delete-toot ()
"Should return correct triaged response to a legitimate DELETE request."
@@ -133,16 +134,17 @@ mention string."
(let ((delete-response (current-buffer))
(toot mastodon-toot-test-base-toot))
(with-mock
- (mock (mastodon-tl--property 'toot-json) => toot)
- ;; (mock (mastodon-toot--own-toot-p toot) => t)
- (mock (mastodon-auth--user-acct) => "acct42@example.space")
- (mock (mastodon-http--api (format "statuses/61208"))
- => "https://example.space/statuses/61208")
- (mock (y-or-n-p "Delete this toot? ") => t)
- (mock (mastodon-http--delete "https://example.space/statuses/61208")
- => delete-response)
- (should (equal (mastodon-toot--delete-toot)
- "Toot deleted!"))))))
+ (mock (mastodon-tl--property 'toot-json) => toot)
+ (mock (mastodon-tl--property 'base-toot) => toot)
+ ;; (mock (mastodon-toot--own-toot-p toot) => t)
+ (mock (mastodon-auth--user-acct) => "acct42@example.space")
+ (mock (mastodon-http--api (format "statuses/61208"))
+ => "https://example.space/statuses/61208")
+ (mock (y-or-n-p "Delete this toot? ") => t)
+ (mock (mastodon-http--delete "https://example.space/statuses/61208")
+ => delete-response)
+ (should (equal (mastodon-toot--delete-toot)
+ "Toot deleted!"))))))
(ert-deftest mastodon-toot-action-pin ()
"Should return callback provided by `mastodon-toot--pin-toot-toggle'."
@@ -167,7 +169,8 @@ mention string."
(let ((pin-response (current-buffer))
(toot mastodon-toot-test-base-toot))
(with-mock
- (mock (mastodon-tl--property 'toot-json) => toot)
- (mock (mastodon-auth--user-acct) => "joebogus@example.space")
- (should (equal (mastodon-toot--pin-toot-toggle)
- "You can only pin your own toots."))))))
+ (mock (mastodon-tl--property 'toot-json) => toot)
+ (mock (mastodon-tl--property 'base-toot) => toot)
+ (mock (mastodon-auth--user-acct) => "joebogus@example.space")
+ (should (equal (mastodon-toot--pin-toot-toggle)
+ "You can only pin your own toots."))))))