diff options
author | Artur Malabarba <bruce.connor.am@gmail.com> | 2015-02-26 22:26:42 -0300 |
---|---|---|
committer | Artur Malabarba <bruce.connor.am@gmail.com> | 2015-02-26 22:26:42 -0300 |
commit | a603180449f9d17f5f7230638f43e3b2c6ecc363 (patch) | |
tree | 5f921eded79a1b1a068a1558d355ca9c9fe783a2 /test | |
parent | d8968604c6d2e11e5365031759069fb5a671f688 (diff) | |
parent | ee4e74f25fdb97faf4cb92952072a42b7b507e2a (diff) |
Merge branch 'generate-header-line-from-keymap' into delete-command
Diffstat (limited to 'test')
-rw-r--r-- | test/test-api.el | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/test-api.el b/test/test-api.el index b7d5dbb..faf2e0a 100644 --- a/test/test-api.el +++ b/test/test-api.el @@ -14,3 +14,26 @@ (ert-deftest test-method-get-all () "Tests sx-method interface to `sx-request-all-items'" (should (< 250 (length (sx-method-call 'sites :get-all t))))) + +(ert-deftest request-get-url () + (should (sx-request-get-url "http://google.com")) + (should-error (sx-request-get-url "http://github.com/Bruce-Connor/does-not-exist")) + (when sx-question-mode-use-images + (should + ;; If image is not recognized, this returns nil. + (create-image (sx-request-get-url "https://raw.githubusercontent.com/vermiculus/sx.el/master/list-and-question.png") + 'imagemagick t + :width sx-question-mode-image-max-width))) + ;; In case imagemacgick is not available, let's try png so we at + ;; least test the function. + (when (image-type-available-p 'png) + (should + (create-image (sx-request-get-url "https://raw.githubusercontent.com/vermiculus/sx.el/master/list-and-question.png") + 'png t + :width sx-question-mode-image-max-width)))) + +(ert-deftest request-get-data () + (should-error (sx-request-get-data "tags/emacs-does-not-exist")) + (let ((emacs-tags (sx-request-get-data 'tags/emacs))) + (should (> (length emacs-tags) 450)) + (should (not (cl-remove-if #'stringp emacs-tags))))) |