Skip to content

Commit

Permalink
testing/lisp: Update to handle new download policy
Browse files Browse the repository at this point in the history
* testing/lisp/test-ox.el: Bind `org-resource-download-policy' to t when
testing downloading.

* testing/lisp/test-org.el: Bind `org-resource-download-policy' to t
when testing downloading.
  • Loading branch information
tecosaur committed Jul 20, 2022
1 parent df1814b commit db6c229
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
23 changes: 12 additions & 11 deletions testing/lisp/test-org.el
Original file line number Diff line number Diff line change
Expand Up @@ -3439,17 +3439,18 @@ SCHEDULED: <2017-05-06 Sat>
(progn (org-file-contents "this-file-must-not-exist" :noerror) t))
;; Open URL.
(should
(string= "foo"
(let ((buffer (generate-new-buffer "url-retrieve-output")))
(unwind-protect
;; Simulate successful retrieval of a URL.
(cl-letf (((symbol-function 'url-retrieve-synchronously)
(lambda (&rest_)
(with-current-buffer buffer
(insert "HTTP/1.1 200 OK\n\nfoo"))
buffer)))
(org-file-contents "http://some-valid-url"))
(kill-buffer buffer)))))
(let ((org-resource-download-policy t))
(string= "foo"
(let ((buffer (generate-new-buffer "url-retrieve-output")))
(unwind-protect
;; Simulate successful retrieval of a URL.
(cl-letf (((symbol-function 'url-retrieve-synchronously)
(lambda (&rest_)
(with-current-buffer buffer
(insert "HTTP/1.1 200 OK\n\nfoo"))
buffer)))
(org-file-contents "http://some-valid-url"))
(kill-buffer buffer))))))
;; Throw error when trying to access an invalid URL.
(should-error
(let ((buffer (generate-new-buffer "url-retrieve-output")))
Expand Down
3 changes: 2 additions & 1 deletion testing/lisp/test-ox.el
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,8 @@ num:2 <:active")))
(org-export--get-inbuffer-options))
'(:language "fr" :select-tags ("a" "b" "c") :title ("a b c"))))
;; Options set through SETUPFILE specified using a URL.
(let ((buffer (generate-new-buffer "url-retrieve-output")))
(let ((buffer (generate-new-buffer "url-retrieve-output"))
(org-resource-download-policy t))
(unwind-protect
;; Simulate successful retrieval of a setupfile from URL.
(cl-letf (((symbol-function 'url-retrieve-synchronously)
Expand Down

0 comments on commit db6c229

Please sign in to comment.