From 5bbfebc92d6ff8e66e3072c453f6c3a44129cab2 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Mon, 5 Aug 2024 20:40:16 +0200 Subject: fix one search by handle test --- test/mastodon-profile-tests.el | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'test/mastodon-profile-tests.el') diff --git a/test/mastodon-profile-tests.el b/test/mastodon-profile-tests.el index d187e2d..be7f50e 100644 --- a/test/mastodon-profile-tests.el +++ b/test/mastodon-profile-tests.el @@ -170,11 +170,10 @@ When formatting Gargon's state we want to see The search will happen as if called without the \"@\"." (with-mock - (mock (mastodon-http--get-json - "https://instance.url/api/v1/accounts/search" - '(("q" . "gargron")))) - + "https://instance.url/api/v2/search" + '(("q" . "gargron") + ("type" . "accounts")))) (let ((mastodon-instance-url "https://instance.url")) ;; We don't check anything from the return value. We only care ;; that the mocked fetch was called with the expected URL. -- cgit v1.2.3 From c45cb5edf3ba9f8c4f494942a29c8ccee401617c Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Mon, 5 Aug 2024 20:57:54 +0200 Subject: fix profile search account tests --- test/mastodon-profile-tests.el | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'test/mastodon-profile-tests.el') diff --git a/test/mastodon-profile-tests.el b/test/mastodon-profile-tests.el index be7f50e..e0431b4 100644 --- a/test/mastodon-profile-tests.el +++ b/test/mastodon-profile-tests.el @@ -23,12 +23,12 @@ (statuses_count . 70741) (last_status_at . "2021-11-14") (emojis . []) - (fields . [((name . "Patreon") + (fields . (((name . "Patreon") (value . "https://www.patreon.com/mastodon") (verified_at)) ((name . "Homepage") (value . "https://zeonfederated.com") - (verified_at . "2019-07-15T18:29:57.191+00:00"))]))) + (verified_at . "2019-07-15T18:29:57.191+00:00")))))) (defconst ccc-profile-json '((id . "369027") @@ -105,10 +105,10 @@ (website)) (account ,@gargron-profile-json) (media_attachments . []) - (mentions . [((id . "369027") + (mentions . (((id . "369027") (username . "CCC") (url . "https://social.bau-ha.us/@CCC") - (acct . "CCC@social.bau-ha.us"))]) + (acct . "CCC@social.bau-ha.us")))) (tags . []) (emojis . []) (card) @@ -183,11 +183,10 @@ The search will happen as if called without the \"@\"." "Should ignore results that don't match the searched handle." (with-mock (mock (mastodon-http--get-json - "https://instance.url/api/v1/accounts/search" - '(("q" . "Gargron"))) - => - (vector ccc-profile-json gargron-profile-json)) - + "https://instance.url/api/v2/search" + '(("q" . "Gargron") + ("type" . "accounts"))) + => `((accounts ,ccc-profile-json ,gargron-profile-json))) (let ((mastodon-instance-url "https://instance.url")) (should (equal @@ -199,9 +198,11 @@ The search will happen as if called without the \"@\"." TODO: We need to decide if this is actually desired or not." (with-mock - (mock (mastodon-http--get-json * - '(("q" . "gargron"))) - => (vector gargron-profile-json)) + (mock (mastodon-http--get-json + "https://instance.url/api/v2/search" + '(("q" . "gargron") + ("type" . "accounts"))) + => `((accounts ,ccc-profile-json ,gargron-profile-json))) (let ((mastodon-instance-url "https://instance.url")) (should -- cgit v1.2.3 From 0d7e634136982a2812a9b76e84483222c83b33ec Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Tue, 13 Aug 2024 17:30:41 +0200 Subject: fix profile test - make author buffer, interactively, but not batch --- test/mastodon-profile-tests.el | 51 ++++++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 22 deletions(-) (limited to 'test/mastodon-profile-tests.el') diff --git a/test/mastodon-profile-tests.el b/test/mastodon-profile-tests.el index e0431b4..289e8d9 100644 --- a/test/mastodon-profile-tests.el +++ b/test/mastodon-profile-tests.el @@ -234,23 +234,23 @@ 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" 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") + ()) + (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-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 "")) @@ -263,34 +263,41 @@ content generation in the function under test." (should (equal - (buffer-substring-no-properties (point-min) (point-max)) + (with-current-buffer "*mastodon-Gargron-statuses*" + (buffer-substring-no-properties (point-min) (point-max))) (concat "\n" "[img] [img] \n" "Eugen\n" "@Gargron\n" - " ------------\n" + " ――――――――――――\n" "

Developer of Mastodon and administrator of mastodon.social. I post service announcements, development updates, and personal stuff.

\n" "_ Patreon __ :: https://www.patreon.com/mastodon_ Homepage _ :: https://zeonfederated.com" "\n" "Joined March 2016" - "\n\n" - " ------------\n" - " TOOTS: 70741 | FOLLOWERS: 470905 | FOLLOWING: 451\n" - " ------------\n" + "\n\n " + mastodon-tl--horiz-bar "\n" - " ------------\n" - " TOOTS \n" - " ------------\n" + " TOOTS: 70741 | FOLLOWERS: 470905 | FOLLOWING: 451\n " + mastodon-tl--horiz-bar "\n" - "

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.

\n" - " Eugen (@Gargron) 2021-11-11 11:11:11\n" - " ------------\n" + "\n " + mastodon-tl--horiz-bar "\n" + " TOOTS \n " + mastodon-tl--horiz-bar "\n" - "

@CCC 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.

\n" - " Eugen (@Gargron) 2021-11-11 00:00:00\n" - " ------------\n" + "\n" + "

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.

\n" + " Eugen (@Gargron) 2021-11-11 12:11:11\n " + mastodon-tl--horiz-bar + " 0 ⭐ | 0 🔁 | 0 💬\n" + "\n" + "\n" + "

@CCC 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.

\n" + " Eugen (@Gargron) 2021-11-11 01:00:00\n " + mastodon-tl--horiz-bar + " 0 ⭐ | 2 🔁 | 0 💬\n" "\n" ))) -- cgit v1.2.3