aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnson Denen <johnson.denen@gmail.com>2017-04-10 22:02:19 -0400
committerJohnson Denen <johnson.denen@gmail.com>2017-04-10 22:08:53 -0400
commit2d79c9c5cffd0cc8bec683438f39d5c02b590aab (patch)
tree3c4743219c7211e159024f52939276df89ae3192
parent3b318408c23fab306a01c9a54b109e807b560459 (diff)
Add tests for mastodon-toot.el functions
-rw-r--r--test/mastodon-toot-tests.el25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/mastodon-toot-tests.el b/test/mastodon-toot-tests.el
new file mode 100644
index 0000000..cdd3bb9
--- /dev/null
+++ b/test/mastodon-toot-tests.el
@@ -0,0 +1,25 @@
+(require 'el-mock)
+(load-file "../lisp/mastodon-toot.el")
+
+(ert-deftest mastodon-toot:cancel ()
+ (with-mock
+ (mock (kill-buffer-and-window))
+ (should (eq nil (mastodon-toot--cancel)))))
+
+(ert-deftest mastodon-toot:send ()
+ (with-mock
+ (stub mastodon--api-for => "https://instance/api/v/statuses")
+ (stub buffer-string => "This is a test toot")
+ (stub kill-buffer-and-window)
+ (stub mastodon--access-token => "access-token-string")
+ (mock (mastodon--http-post "https://instance/api/v/statuses"
+ 'mastodon-toot--send-triage
+ '(("status" . "This is a test toot"))
+ '(("Authorization" . "Bearer access-token-string"))))
+ (should (eq nil (mastodon-toot--send)))))
+
+(ert-deftest mastodon-toot:send-triage ()
+ (with-mock
+ (mock (mastodon--http-response-triage "status"
+ (lambda () (switch-to-buffer (current-buffer)))))
+ (should (eq nil (mastodon-toot--send-triage "status")))))