diff options
author | Holger Dürer <me@hdurer.net> | 2021-11-01 15:53:37 +0100 |
---|---|---|
committer | Holger Dürer <me@hdurer.net> | 2021-11-01 15:53:37 +0100 |
commit | e7c7da386c812f9452b072567e822077180f3dc5 (patch) | |
tree | cfd28454b3c54404381620a1e77e722b6d5e9740 /lisp/mastodon-http.el | |
parent | d7593a06912b7946d2fb318093ec7e27c64b3be7 (diff) |
Fix tests.
These needed a bit of tender love and care to get back into passing
state.
- Move the auth tests to the `test` directory. No idea what it was
doing in `lisp`.
- Image tests are mostly broken because with later Emacsen we no
longer need the `imagemagic` option on create-image.
- Some method signatures have changed and mocking calls needed to
follow suit.
Diffstat (limited to 'lisp/mastodon-http.el')
-rw-r--r-- | lisp/mastodon-http.el | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lisp/mastodon-http.el b/lisp/mastodon-http.el index 27f8ef0..875e9bf 100644 --- a/lisp/mastodon-http.el +++ b/lisp/mastodon-http.el @@ -3,7 +3,7 @@ ;; Copyright (C) 2017-2019 Johnson Denen ;; Author: Johnson Denen <johnson.denen@gmail.com> ;; Version: 0.9.1 -;; Package-Requires: ((emacs "26.1") (request "0.2.0")) +;; Package-Requires: ((emacs "27.1") (request "0.2.0")) ;; Homepage: https://github.com/jdenen/mastodon.el ;; This file is not part of GNU Emacs. @@ -127,9 +127,17 @@ Pass response buffer to CALLBACK function." (url-request-extra-headers `(("Authorization" . ,(concat "Bearer " (mastodon-auth--access-token)))))) - (if (< (cdr (func-arity 'url-retrieve-synchronously)) 4) - (url-retrieve-synchronously url) - (url-retrieve-synchronously url nil nil mastodon-http--timeout)))) + (mastodon-http--url-retrieve-synchronously url))) + +(defun mastodon-http--url-retrieve-synchronously (url) + "Retrieve URL asynchronously. + +This is a thin abstraction over the system +`url-retrieve-synchronously`. Depending on which version of this +is available we will call it with or without a timeout." + (if (< (cdr (func-arity 'url-retrieve-synchronously)) 4) + (url-retrieve-synchronously url) + (url-retrieve-synchronously url nil nil mastodon-http--timeout))) (defun mastodon-http--get-json (url) "Make synchronous GET request to URL. Return JSON response." |