aboutsummaryrefslogtreecommitdiff
path: root/test/mastodon-tl-tests.el
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus@riseup.net>2023-10-28 11:36:58 +0200
committermarty hiatt <martianhiatus@riseup.net>2023-10-28 11:39:25 +0200
commitb8d0c9b967fbc1e38e4012ad357a7f29c621acc1 (patch)
treeab3f5f4f697b6d3d5f330d2e33aa8fa118ac7778 /test/mastodon-tl-tests.el
parent5f237982e53f0804f03f88d20eecab864ab575d3 (diff)
triage: call cb on response. do-user-action-fun: check response data
this means the triage callback always needs to handle 1 arg.
Diffstat (limited to 'test/mastodon-tl-tests.el')
-rw-r--r--test/mastodon-tl-tests.el102
1 files changed, 57 insertions, 45 deletions
diff --git a/test/mastodon-tl-tests.el b/test/mastodon-tl-tests.el
index be72f66..2aa0505 100644
--- a/test/mastodon-tl-tests.el
+++ b/test/mastodon-tl-tests.el
@@ -1090,56 +1090,68 @@ correct value for following, as well as notifications enabled or disabled."
(let ((response-buffer-true (current-buffer)))
(insert mastodon-tl--follow-notify-true-response)
(with-mock
- (mock (mastodon-http--post url-follow-only nil)
- => response-buffer-true)
- (should
- (equal
- (mastodon-tl--do-user-action-function url-follow-only
- user-name
- user-handle
- "follow")
- "User some-user (@some-user@instance.url) followed!"))
- (mock (mastodon-http--post url-mute nil)
- => response-buffer-true)
- (should
- (equal
- (mastodon-tl--do-user-action-function url-mute
- user-name
- user-handle
- "mute")
- "User some-user (@some-user@instance.url) muted!"))
- (mock (mastodon-http--post url-block nil)
- => response-buffer-true)
- (should
- (equal
- (mastodon-tl--do-user-action-function url-block
- user-name
- user-handle
- "block")
- "User some-user (@some-user@instance.url) blocked!")))
+ (mock (mastodon-http--post url-follow-only nil)
+ => response-buffer-true)
+ (should
+ (equal
+ (mastodon-tl--do-user-action-function url-follow-only
+ user-name
+ user-handle
+ "follow")
+ "User some-user (@some-user@instance.url) followed!")))))
+ (with-temp-buffer
+ (let ((response-buffer-true (current-buffer)))
+ (insert mastodon-tl--follow-notify-true-response)
+ (with-mock
+ (mock (mastodon-http--post url-mute nil)
+ => response-buffer-true)
+ (should
+ (equal
+ (mastodon-tl--do-user-action-function url-mute
+ user-name
+ user-handle
+ "mute")
+ "User some-user (@some-user@instance.url) muted!")))))
+ (with-temp-buffer
+ (let ((response-buffer-true (current-buffer)))
+ (insert mastodon-tl--follow-notify-true-response)
+ (with-mock
+ (mock (mastodon-http--post url-block nil)
+ => response-buffer-true)
+ (should
+ (equal
+ (mastodon-tl--do-user-action-function url-block
+ user-name
+ user-handle
+ "block")
+ "User some-user (@some-user@instance.url) blocked!")))))
+ (with-temp-buffer
+ (let ((response-buffer-true (current-buffer)))
+ (insert mastodon-tl--follow-notify-true-response)
(with-mock
- (mock (mastodon-http--post url-true nil) => response-buffer-true)
- (should
- (equal
- (mastodon-tl--do-user-action-function url-true
- user-name
- user-handle
- "follow"
- "true")
- "Receiving notifications for user some-user (@some-user@instance.url)!")))))
+ (with-mock
+ (mock (mastodon-http--post url-true nil) => response-buffer-true)
+ (should
+ (equal
+ (mastodon-tl--do-user-action-function url-true
+ user-name
+ user-handle
+ "follow"
+ "true")
+ "Receiving notifications for user some-user (@some-user@instance.url)!"))))))
(with-temp-buffer
(let ((response-buffer-false (current-buffer)))
(insert mastodon-tl--follow-notify-false-response)
(with-mock
- (mock (mastodon-http--post url-false nil) => response-buffer-false)
- (should
- (equal
- (mastodon-tl--do-user-action-function url-false
- user-name
- user-handle
- "follow"
- "false")
- "Not receiving notifications for user some-user (@some-user@instance.url)!")))))))
+ (mock (mastodon-http--post url-false nil) => response-buffer-false)
+ (should
+ (equal
+ (mastodon-tl--do-user-action-function url-false
+ user-name
+ user-handle
+ "follow"
+ "false")
+ "Not receiving notifications for user some-user (@some-user@instance.url)!")))))))
(ert-deftest mastodon-tl--report-to-mods-params-alist ()
""