diff options
author | Abhiseck Paira <abhiseckpaira@disroot.org> | 2022-02-11 00:48:00 +0530 |
---|---|---|
committer | Abhiseck Paira <abhiseckpaira@disroot.org> | 2022-02-11 00:48:00 +0530 |
commit | ca740c747ae23370c2850b5df6262e366375d7e4 (patch) | |
tree | 5227766be54c79ac81977bbd4ae302f4eaa0bfcc /test | |
parent | 7f6102b2ac7ba8b520b3ae53717dd064e0eebee8 (diff) |
test: merge mastodon-client--store1 and *store2
Merge `mastodon-client--store1' and `mastodon-client--store2' into a
single test `mastodon-client--store' that test the function with the
same name.
Diffstat (limited to 'test')
-rw-r--r-- | test/mastodon-client-tests.el | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/test/mastodon-client-tests.el b/test/mastodon-client-tests.el index 3f6cc29..6291d02 100644 --- a/test/mastodon-client-tests.el +++ b/test/mastodon-client-tests.el @@ -24,25 +24,22 @@ (current-buffer))) (should (equal (mastodon-client--fetch) '(:foo "bar")))))) -(ert-deftest mastodon-client--store-1 () - "Should return the client plist." +(ert-deftest mastodon-client--store () + "Test the value `mastodon-client--store' returns/stores." (let ((mastodon-instance-url "http://mastodon.example") (plist '(:client_id "id" :client_secret "secret"))) (with-mock (mock (mastodon-client--token-file) => "stubfile.plstore") - (mock (mastodon-client--fetch) => '(:client_id "id" :client_secret "secret")) - (let* ((plstore (plstore-open "stubfile.plstore")) - (client (cdr (plstore-get plstore "mastodon-http://mastodon.example")))) - (should (equal (mastodon-client--store) plist)))))) + (mock (mastodon-client--fetch) => plist) + (should (equal (mastodon-client--store) plist))) + (let* ((plstore (plstore-open "stubfile.plstore")) + (client (mastodon-client--remove-key-from-plstore + (plstore-get plstore "mastodon-http://mastodon.example")))) + (plstore-close plstore) + (should (equal client plist)) + ;; clean up - delete the stubfile + (delete-file "stubfile.plstore")))) -(ert-deftest mastodon-client--store-2 () - "Should store client in `mastodon-client--token-file'." - (let* ((mastodon-instance-url "http://mastodon.example") - (plstore (plstore-open "stubfile.plstore")) - (client (cdr (plstore-get plstore "mastodon-http://mastodon.example")))) - (plstore-close plstore) - (should (string= (plist-get client :client_id) "id")) - (should (string= (plist-get client :client_secret) "secret")))) (ert-deftest mastodon-client--read-finds-match () "Should return mastodon client from `mastodon-token-file' if it exists." |