diff options
author | Holger Dürer <me@hdurer.net> | 2021-11-08 20:17:23 +0100 |
---|---|---|
committer | Holger Dürer <me@hdurer.net> | 2021-11-10 20:12:12 +0100 |
commit | 6b4a47290bf32f5be670d6aa92c3e7780e667ff3 (patch) | |
tree | 087d753d25030b8f3bbbab4566e5ab818640c858 | |
parent | 1892014062229f3b68136495e53e90a51dfa58a1 (diff) |
Change `mastodon-auth-test.el` to not expect errors.
Instead let's catch the error and then assert the correct error text.
This is more specific and also looks nicer on a test run as there are
no `F` symbols for the (expected) failures.
-rw-r--r-- | test/mastodon-auth-test.el | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/test/mastodon-auth-test.el b/test/mastodon-auth-test.el index 9a765b9..4372047 100644 --- a/test/mastodon-auth-test.el +++ b/test/mastodon-auth-test.el @@ -36,12 +36,24 @@ (should (string= "foo" (mastodon-auth--handle-token-response '(:access_token "foo" :token_type "Bearer" :scope "read write follow" :created_at 0))))) (ert-deftest mastodon-auth--handle-token-response--unknown () - :expected-result :failed - (mastodon-auth--handle-token-response '(:herp "derp"))) + (should + (equal + '(error "Unknown response from mastodon-auth--get-token!") + (condition-case error + (progn + (mastodon-auth--handle-token-response '(:herp "derp")) + nil) + (t error))))) (ert-deftest mastodon-auth--handle-token-response--failure () - :expected-result :failed - (mastodon-auth--handle-token-response '(:error "invalid_grant" :error_description "The provided authorization grant is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client."))) + (let ((error-message "The provided authorization grant is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client.")) + (should + (equal + `(error ,(format "Mastodon-auth--access-token: invalid_grant: %s" error-message)) + (condition-case error + (mastodon-auth--handle-token-response + `(:error "invalid_grant" :error_description ,error-message)) + (t error)))))) (provide 'mastodon-auth--test) ;;; mastodon-auth--test.el ends here |