aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/mastodon-notifications-tests.el8
-rw-r--r--test/mastodon-profile-tests.el116
-rw-r--r--test/mastodon-tl-tests.el90
-rw-r--r--test/mastodon-toot-tests.el16
4 files changed, 115 insertions, 115 deletions
diff --git a/test/mastodon-notifications-tests.el b/test/mastodon-notifications-tests.el
index 7c87933..bc70e49 100644
--- a/test/mastodon-notifications-tests.el
+++ b/test/mastodon-notifications-tests.el
@@ -187,11 +187,11 @@
"Ensure get request format for notifictions is accurate."
(let ((mastodon-instance-url "https://instance.url"))
(with-mock
- (mock (mastodon-http--get-json "https://instance.url/api/v1/notifications"))
- (mock (mastodon-profile-fetch-server-account-settings)
- => '(max_toot_chars 1312 privacy "public" display_name "Eugen" discoverable t locked :json-false bot :json-false sensitive :json-false language ""))
+ (mock (mastodon-http--get-json "https://instance.url/api/v1/notifications"))
+ (mock (mastodon-profile--fetch-server-account-settings)
+ => '(max_toot_chars 1312 privacy "public" display_name "Eugen" discoverable t locked :json-false bot :json-false sensitive :json-false language ""))
- (mastodon-notifications--get))))
+ (mastodon-notifications--get))))
(defun mastodon-notifications--test-type (fun sample)
"Test notification draw functions.
diff --git a/test/mastodon-profile-tests.el b/test/mastodon-profile-tests.el
index 267e48b..9d1ec72 100644
--- a/test/mastodon-profile-tests.el
+++ b/test/mastodon-profile-tests.el
@@ -227,64 +227,64 @@ help identify when things change unexpectedly.
TODO: Consider separating the data retrieval and the actual
content generation in the function under test."
(with-mock
- ;; Don't start any image loading:
- (mock (mastodon-media--inline-images * *) => nil)
- (if (version< emacs-version "27.1")
- (mock (image-type-available-p 'imagemagick) => t)
- (mock (image-transforms-p) => t))
- (mock (mastodon-http--get-json "https://instance.url/api/v1/accounts/1/statuses")
- =>
- gargon-statuses-json)
- (mock (mastodon-profile--get-statuses-pinned *)
- =>
- [])
- (mock (mastodon-profile--relationships-get "1")
- =>
- '(((id . "1") (following . :json-false) (showing_reblogs . :json-false) (notifying . :json-false) (followed_by . :json-false) (blocking . :json-false) (blocked_by . :json-false) (muting . :json-false) (muting_notifications . :json-false) (requested . :json-false) (domain_blocking . :json-false) (endorsed . :json-false) (note . ""))))
- ;; Let's not do formatting as that makes it hard to not rely on
- ;; window width and reflowing the text.
- (mock (shr-render-region * *) => nil)
- ;; Don't perform the actual update call at the end.
- ;;(mock (mastodon-tl--timeline *))
- (mock (mastodon-profile-fetch-server-account-settings)
- => '(max_toot_chars 1312 privacy "public" display_name "Eugen" discoverable t locked :json-false bot :json-false sensitive :json-false language ""))
+ ;; Don't start any image loading:
+ (mock (mastodon-media--inline-images * *) => nil)
+ (if (version< emacs-version "27.1")
+ (mock (image-type-available-p 'imagemagick) => t)
+ (mock (image-transforms-p) => t))
+ (mock (mastodon-http--get-json "https://instance.url/api/v1/accounts/1/statuses")
+ =>
+ gargon-statuses-json)
+ (mock (mastodon-profile--get-statuses-pinned *)
+ =>
+ [])
+ (mock (mastodon-profile--relationships-get "1")
+ =>
+ '(((id . "1") (following . :json-false) (showing_reblogs . :json-false) (notifying . :json-false) (followed_by . :json-false) (blocking . :json-false) (blocked_by . :json-false) (muting . :json-false) (muting_notifications . :json-false) (requested . :json-false) (domain_blocking . :json-false) (endorsed . :json-false) (note . ""))))
+ ;; Let's not do formatting as that makes it hard to not rely on
+ ;; window width and reflowing the text.
+ (mock (shr-render-region * *) => nil)
+ ;; Don't perform the actual update call at the end.
+ ;;(mock (mastodon-tl--timeline *))
+ (mock (mastodon-profile--fetch-server-account-settings)
+ => '(max_toot_chars 1312 privacy "public" display_name "Eugen" discoverable t locked :json-false bot :json-false sensitive :json-false language ""))
- (let ((mastodon-tl--show-avatars t)
- (mastodon-tl--display-media-p t)
- (mastodon-instance-url "https://instance.url"))
- (mastodon-profile--make-author-buffer gargron-profile-json)
+ (let ((mastodon-tl--show-avatars t)
+ (mastodon-tl--display-media-p t)
+ (mastodon-instance-url "https://instance.url"))
+ (mastodon-profile--make-author-buffer gargron-profile-json)
- (should
- (equal
- (buffer-substring-no-properties (point-min) (point-max))
- (concat
- "\n"
- "[img] [img] \n"
- "Eugen\n"
- "@Gargron\n"
- " ------------\n"
- "<p>Developer of Mastodon and administrator of mastodon.social. I post service announcements, development updates, and personal stuff.</p>\n"
- "_ Patreon __ :: <a href=\"https://www.patreon.com/mastodon\" rel=\"me nofollow noopener noreferrer\" target=\"_blank\"><span class=\"invisible\">https://www.</span><span class=\"\">patreon.com/mastodon</span><span class=\"invisible\"></span></a>_ Homepage _ :: <a href=\"https://zeonfederated.com\" rel=\"me nofollow noopener noreferrer\" target=\"_blank\"><span class=\"invisible\">https://</span><span class=\"\">zeonfederated.com</span><span class=\"invisible\"></span></a>\n"
- " ------------\n"
- " TOOTS: 70741 | FOLLOWERS: 470905 | FOLLOWING: 451\n"
- " ------------\n"
- "\n"
- " ------------\n"
- " TOOTS \n"
- " ------------\n"
- "\n"
- "<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.</p> \n"
- " Eugen (@Gargron) 2021-11-11 11:11:11\n"
- " ------------\n"
- "\n"
- "\n"
- "<p><span class=\"h-card\"><a href=\"https://social.bau-ha.us/@CCC\" class=\"u-url mention\">@<span>CCC</span></a></span> At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</p> \n"
- " Eugen (@Gargron) 2021-11-11 00:00:00\n"
- " ------------\n"
- "\n"
- )))
+ (should
+ (equal
+ (buffer-substring-no-properties (point-min) (point-max))
+ (concat
+ "\n"
+ "[img] [img] \n"
+ "Eugen\n"
+ "@Gargron\n"
+ " ------------\n"
+ "<p>Developer of Mastodon and administrator of mastodon.social. I post service announcements, development updates, and personal stuff.</p>\n"
+ "_ Patreon __ :: <a href=\"https://www.patreon.com/mastodon\" rel=\"me nofollow noopener noreferrer\" target=\"_blank\"><span class=\"invisible\">https://www.</span><span class=\"\">patreon.com/mastodon</span><span class=\"invisible\"></span></a>_ Homepage _ :: <a href=\"https://zeonfederated.com\" rel=\"me nofollow noopener noreferrer\" target=\"_blank\"><span class=\"invisible\">https://</span><span class=\"\">zeonfederated.com</span><span class=\"invisible\"></span></a>\n"
+ " ------------\n"
+ " TOOTS: 70741 | FOLLOWERS: 470905 | FOLLOWING: 451\n"
+ " ------------\n"
+ "\n"
+ " ------------\n"
+ " TOOTS \n"
+ " ------------\n"
+ "\n"
+ "<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.</p> \n"
+ " Eugen (@Gargron) 2021-11-11 11:11:11\n"
+ " ------------\n"
+ "\n"
+ "\n"
+ "<p><span class=\"h-card\"><a href=\"https://social.bau-ha.us/@CCC\" class=\"u-url mention\">@<span>CCC</span></a></span> At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</p> \n"
+ " Eugen (@Gargron) 2021-11-11 00:00:00\n"
+ " ------------\n"
+ "\n"
+ )))
- ;; Until the function gets refactored this creates a non-temp
- ;; buffer with Gargron's statuses which we want to delete (if
- ;; the tests succeed).
- (kill-buffer))))
+ ;; Until the function gets refactored this creates a non-temp
+ ;; buffer with Gargron's statuses which we want to delete (if
+ ;; the tests succeed).
+ (kill-buffer))))
diff --git a/test/mastodon-tl-tests.el b/test/mastodon-tl-tests.el
index bb5d00f..19934dd 100644
--- a/test/mastodon-tl-tests.el
+++ b/test/mastodon-tl-tests.el
@@ -1047,53 +1047,53 @@ 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 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 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 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)
+ => 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)
+ => 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)
+ => 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-mock
- (mock (mastodon-http--post url-true nil 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)!")))))
+ (mock (mastodon-http--post url-true) => 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 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) => 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)!")))))))
diff --git a/test/mastodon-toot-tests.el b/test/mastodon-toot-tests.el
index 39e0984..9741964 100644
--- a/test/mastodon-toot-tests.el
+++ b/test/mastodon-toot-tests.el
@@ -152,14 +152,14 @@ mention string."
(toot mastodon-toot-test-base-toot)
(id 61208))
(with-mock
- (mock (mastodon-tl--property 'base-toot-id) => id)
- (mock (mastodon-http--api "statuses/61208/pin")
- => "https://example.space/statuses/61208/pin")
- (mock (mastodon-http--post "https://example.space/statuses/61208/pin" nil nil)
- => pin-response)
- (should (equal (mastodon-toot--action "pin" (lambda ()
- (message "Toot pinned!")))
- "Toot pinned!"))))))
+ (mock (mastodon-tl--property 'base-toot-id) => id)
+ (mock (mastodon-http--api "statuses/61208/pin")
+ => "https://example.space/statuses/61208/pin")
+ (mock (mastodon-http--post "https://example.space/statuses/61208/pin")
+ => pin-response)
+ (should (equal (mastodon-toot--action "pin" (lambda ()
+ (message "Toot pinned!")))
+ "Toot pinned!"))))))
(ert-deftest mastodon-toot--pin-toot-fail ()
(with-temp-buffer