diff options
author | Abhiseck Paira <abhiseckpaira@disroot.org> | 2022-02-16 21:57:04 +0530 |
---|---|---|
committer | Abhiseck Paira <abhiseckpaira@disroot.org> | 2022-02-16 21:58:11 +0530 |
commit | f1ef6f7c8accc7ce3fd44373776727afe3d8957c (patch) | |
tree | 9ededf38661e4cd726eb93b2655d765ed923042c /test/mastodon-client-tests.el | |
parent | c589a9451a9b9b6e942fa8de9ece41ce9e8bd174 (diff) |
test: add test for mastodon-client--general-read
Diffstat (limited to 'test/mastodon-client-tests.el')
-rw-r--r-- | test/mastodon-client-tests.el | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/mastodon-client-tests.el b/test/mastodon-client-tests.el index 6291d02..3c667b1 100644 --- a/test/mastodon-client-tests.el +++ b/test/mastodon-client-tests.el @@ -49,6 +49,27 @@ (should (equal (mastodon-client--read) '(:client_id "id2" :client_secret "secret2")))))) +(ert-deftest mastodon-client--general-read-finds-match () + (with-mock + (mock (mastodon-client--token-file) => "fixture/client.plstore") + (should (equal (mastodon-client--general-read "user-test8000@mastodon.example") + '(:username "test8000@mastodon.example" + :instance "http://mastodon.example" + :client_id "id2" :client_secret "secret2" + :access_token "token2"))))) + +(ert-deftest mastodon-client--general-read-finds-no-match () + (with-mock + (mock (mastodon-client--token-file) => "fixture/client.plstore") + (should (equal (mastodon-client--general-read "nonexistant-key") + nil)))) + +(ert-deftest mastodon-client--general-read-empty-store () + (with-mock + (mock (mastodon-client--token-file) => "fixture/empty.plstore") + (should (equal (mastodon-client--general-read "something") + nil)))) + (ert-deftest mastodon-client--read-finds-no-match () "Should return mastodon client from `mastodon-token-file' if it exists." (let ((mastodon-instance-url "http://mastodon.social")) |