From e20f074de9927451a8f3f496632a39e4937b78b8 Mon Sep 17 00:00:00 2001 From: Johnson Denen Date: Wed, 12 Apr 2017 13:55:23 -0400 Subject: Add tests for `mastodon--access-token' --- lisp/mastodon-auth.el | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'lisp') diff --git a/lisp/mastodon-auth.el b/lisp/mastodon-auth.el index 1f4adaf..a35dc5a 100644 --- a/lisp/mastodon-auth.el +++ b/lisp/mastodon-auth.el @@ -135,18 +135,21 @@ Authenticates with email address and password. Neither are not stored." ("password" . ,passwd) ("scope" . "read write follow"))))) +(defun mastodon-auth--token () + "Return `mastodon--api-token-string'." + mastodon--api-token-string) + (defun mastodon--access-token () "Return `mastodon--api-token-string'. If not set, retrieves token with `mastodon--get-access-token'." - (if mastodon--api-token-string - mastodon--api-token-string - (progn - (mastodon--get-access-token) - (while (not mastodon--api-token-string) - (sleep-for 1) - (mastodon--access-token)) - mastodon--api-token-string))) + (or (mastodon-auth--token) + (progn + (mastodon--get-access-token) + (or (mastodon-auth--token) + (progn + (sleep-for 2) + (mastodon--access-token)))))) (provide 'mastodon-auth) ;;; mastodon-auth.el ends here -- cgit v1.2.3