branch: elpa/mastodon commit df65237b55ff87c05ef568ef53cf1554da85a415 Author: marty hiatt <martianhia...@disroot.org> Commit: marty hiatt <martianhia...@disroot.org>
media tests: FIXMEs for non-interactive only failures --- test/mastodon-media-tests.el | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/test/mastodon-media-tests.el b/test/mastodon-media-tests.el index 5c586bfd4a..e9722dd3d8 100644 --- a/test/mastodon-media-tests.el +++ b/test/mastodon-media-tests.el @@ -1,12 +1,23 @@ ;;; mastodon-media-test.el --- Tests for mastodon-media.el -*- lexical-binding: nil -*- +;; non interactive failures: +;; FAILED mastodon-media--get-avatar-rendering +;; FAILED mastodon-media--load-image-from-url-avatar-with-imagemagic +;; FAILED mastodon-media--load-image-from-url-media-link-with-imagemagic +;; FAILED mastodon-media--load-image-from-url-media-link-without-imagemagic +;; FAILED mastodon-media--load-image-from-url-url-fetching-fails + (require 'el-mock) (ert-deftest mastodon-media--get-avatar-rendering () "Should return text with all expected properties." (with-mock ;; (mock (image-type-available-p 'imagemagick) => t) - (mock (create-image * (when (version< emacs-version "27.1") 'imagemagick) t :height 123) => :mock-image) + (mock (create-image * + (when (version< emacs-version "27.1") 'imagemagick) + t + :height 123) ;; FIXME: fails non-interactively, is nil + => :mock-image) (let* ((mastodon-media--avatar-height 123) (result (mastodon-media--get-avatar-rendering "http://example.org/img.png")) @@ -122,14 +133,17 @@ (mock (url-retrieve "http://example.org/image.png" #'mastodon-media--process-image-response - '("http://example.org/image.png" :my-marker (:max-height 321) 5)) + '("http://example.org/image.png" :my-marker + (:max-height 321) ;; FIXME: fails non-interactively: is nil + 5)) => :called-as-expected) (with-temp-buffer (insert (concat "Start:" (mastodon-media--get-media-link-rendering url) ":rest")) (let ((mastodon-media--preview-max-height 321)) - (should (eq :called-as-expected (mastodon-media--load-image-from-url url 'media-link 7 5)))))))) + (should (eq :called-as-expected + (mastodon-media--load-image-from-url url 'media-link 7 5)))))))) (ert-deftest mastodon-media--load-image-from-url-media-link-without-imagemagic () "Should make the right call to url-retrieve." @@ -137,12 +151,14 @@ (with-mock ;; (mock (image-type-available-p 'imagemagick) => nil) ;; (mock (image-transforms-p) => nil) - (mock (create-image * nil t) => '(image foo)) + (mock (create-image * nil t :height 20) => '(image foo)) (mock (copy-marker 7) => :my-marker ) (mock (url-retrieve "http://example.org/image.png" #'mastodon-media--process-image-response - '("http://example.org/image.png" :my-marker (:max-height 321) 5)) + '("http://example.org/image.png" :my-marker + (:max-height 321) ;; FIXME: fails non-interactively: is nil + 5)) => :called-as-expected) (with-temp-buffer @@ -161,7 +177,8 @@ (mock (create-image * (when (version< emacs-version "27.1") 'imagemagick) - t :height 123) + t + :height 123) ;; FIXME: fails non-interactively, is nil => '(image foo)) (stub url-retrieve => (error "url-retrieve failed"))