diff options
author | Artur Malabarba <bruce.connor.am@gmail.com> | 2015-02-26 15:53:56 -0300 |
---|---|---|
committer | Artur Malabarba <bruce.connor.am@gmail.com> | 2015-02-26 15:53:56 -0300 |
commit | b6fc510cf55b2847301c92acc2cd3c128e8a9dff (patch) | |
tree | a12044d5d11c9a1a60ba032fe395e148488fdd0e /test | |
parent | 24090d48422233b31f9eef041814e99c47c2534d (diff) | |
parent | 85dc0ab2137d793a43967e8771933161b1701c47 (diff) |
Merge pull request #242 from vermiculus/images
Images
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))))) |