aboutsummaryrefslogtreecommitdiff
path: root/test/mastodon-auth-test.el
diff options
context:
space:
mode:
authorHolger Dürer <me@hdurer.net>2021-11-09 18:24:54 +0100
committerHolger Dürer <me@hdurer.net>2021-11-10 20:12:12 +0100
commit522926bcca0caf45516da3dcd00c944066641965 (patch)
treea53083dd1483f06e7833e0e0dacbf080cff15293 /test/mastodon-auth-test.el
parent5df05d94926ada6843cbc65aea4b64c18429fdf1 (diff)
Hamonize tests.
- Add a header comment explicitly switching off lexical binding - Harmonize naming (always start with module and double hyphen) - Ensure all tests have at least a minimal doc string. - Move tests from `mastodon-auth-test.el` to `mastodon-auth-tests.el`
Diffstat (limited to 'test/mastodon-auth-test.el')
-rw-r--r--test/mastodon-auth-test.el59
1 files changed, 0 insertions, 59 deletions
diff --git a/test/mastodon-auth-test.el b/test/mastodon-auth-test.el
deleted file mode 100644
index 4372047..0000000
--- a/test/mastodon-auth-test.el
+++ /dev/null
@@ -1,59 +0,0 @@
-;;; mastodon-auth--test.el --- Tests for mastodon-auth -*- lexical-binding: t; -*-
-
-;; Copyright (C) 2020 Ian Eure
-
-;; Author: Ian Eure <ian@retrospec.tv>
-;; Version: 0.9.1
-;; Homepage: https://github.com/jdenen/mastodon.el
-;; Package-Requires: ((emacs "26.1"))
-
-;; This file is not part of GNU Emacs.
-
-;; This file is part of mastodon.el.
-
-;; This program is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation, either version 3 of the License, or
-;; (at your option) any later version.
-
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;; GNU General Public License for more details.
-
-;; You should have received a copy of the GNU General Public License
-;; along with this program. If not, see <https://www.gnu.org/licenses/>.
-
-;;; Commentary:
-
-;; mastodon-auth--test.el provides ERT tests for mastodon-auth.el
-
-;;; Code:
-
-(require 'ert)
-
-(ert-deftest mastodon-auth--handle-token-response--good ()
- (should (string= "foo" (mastodon-auth--handle-token-response '(:access_token "foo" :token_type "Bearer" :scope "read write follow" :created_at 0)))))
-
-(ert-deftest mastodon-auth--handle-token-response--unknown ()
- (should
- (equal
- '(error "Unknown response from mastodon-auth--get-token!")
- (condition-case error
- (progn
- (mastodon-auth--handle-token-response '(:herp "derp"))
- nil)
- (t error)))))
-
-(ert-deftest mastodon-auth--handle-token-response--failure ()
- (let ((error-message "The provided authorization grant is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client."))
- (should
- (equal
- `(error ,(format "Mastodon-auth--access-token: invalid_grant: %s" error-message))
- (condition-case error
- (mastodon-auth--handle-token-response
- `(:error "invalid_grant" :error_description ,error-message))
- (t error))))))
-
-(provide 'mastodon-auth--test)
-;;; mastodon-auth--test.el ends here