diff options
author | Holger Dürer <me@hdurer.net> | 2018-02-28 20:48:24 +0000 |
---|---|---|
committer | Holger Dürer <me@hdurer.net> | 2018-03-02 20:18:22 +0000 |
commit | b774f9e5295341a68171d94765320114d0b5b407 (patch) | |
tree | 5e055a479aa6af15e524bca313ab557c8130684e /test/mastodon-auth-tests.el | |
parent | 3e9bdbf2eeecafd7bb0673f2709f816a740c7d61 (diff) |
Keep track of to which instance secrets in plstore belong.
While testing out issue
149 (https://github.com/jdenen/mastodon.el/issues/149) I had problems
due to stale client information being cached.
With this change we store various pieces of information (the client
information in the plstore and the auth tokens) in alists keyed by the
instance url (and the plstore key contains the instance url as well to
allow us to store data per instance).
Diffstat (limited to 'test/mastodon-auth-tests.el')
-rw-r--r-- | test/mastodon-auth-tests.el | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/test/mastodon-auth-tests.el b/test/mastodon-auth-tests.el index 70c63d8..719a56c 100644 --- a/test/mastodon-auth-tests.el +++ b/test/mastodon-auth-tests.el @@ -14,7 +14,8 @@ ("username" . "foo@bar.com") ("password" . "password") ("scope" . "read write follow")) - nil)) + nil + :unauthenticated)) (mastodon-auth--generate-token)))) (ert-deftest get-token () @@ -26,15 +27,17 @@ (current-buffer))) (should (equal (mastodon-auth--get-token) '(:access_token "abcdefg")))))) -(ert-deftest access-token-1 () - "Should return `mastodon-auth--token' if non-nil." - (let ((mastodon-auth--token "foobar")) +(ert-deftest access-token-found () + "Should return value in `mastodon-auth--token-alist' if found." + (let ((mastodon-instance-url "https://instance.url") + (mastodon-auth--token-alist '(("https://instance.url" . "foobar")) )) (should (string= (mastodon-auth--access-token) "foobar")))) (ert-deftest access-token-2 () "Should set and return `mastodon-auth--token' if nil." - (let ((mastodon-auth--token nil)) + (let ((mastodon-instance-url "https://instance.url") + (mastodon-auth--token nil)) (with-mock (mock (mastodon-auth--get-token) => '(:access_token "foobaz")) (should (string= (mastodon-auth--access-token) "foobaz")) - (should (string= mastodon-auth--token "foobaz"))))) + (should (equal mastodon-auth--token-alist '(("https://instance.url" . "foobaz"))))))) |