From f1ef6f7c8accc7ce3fd44373776727afe3d8957c Mon Sep 17 00:00:00 2001 From: Abhiseck Paira Date: Wed, 16 Feb 2022 21:57:04 +0530 Subject: test: add test for mastodon-client--general-read --- test/mastodon-client-tests.el | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'test/mastodon-client-tests.el') 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")) -- cgit v1.2.3