emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/plz 6f8dfb83de 34/81: Tests: (plz-test-get-response) Ch


From: ELPA Syncer
Subject: [elpa] externals/plz 6f8dfb83de 34/81: Tests: (plz-test-get-response) Change to macro
Date: Wed, 11 May 2022 17:58:00 -0400 (EDT)

branch: externals/plz
commit 6f8dfb83deeaec7b25f184522a6e301f5add64ba
Author: Adam Porter <adam@alphapapa.net>
Commit: Adam Porter <adam@alphapapa.net>

    Tests: (plz-test-get-response) Change to macro
    
    Not sure why these two tests are failing on CI but passing locally.
    Testing each part individually should help.
---
 tests/test-plz.el | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/tests/test-plz.el b/tests/test-plz.el
index 66d5928750..17070866e7 100644
--- a/tests/test-plz.el
+++ b/tests/test-plz.el
@@ -51,16 +51,16 @@
 
 ;;;; Functions
 
-(defun plz-test-get-response (response)
-  "Return non-nil if RESPONSE seems to be a correct GET response."
-  (and (plz-response-p response)
-       (numberp (plz-response-version response))
-       (eq 200 (plz-response-status response))
-       (equal "application/json" (alist-get "Content-Type" 
(plz-response-headers response) nil nil #'equal))
-       (let* ((json (json-read-from-string (plz-response-body response)))
-              (headers (alist-get 'headers json))
-              (user-agent (alist-get 'User-Agent headers nil nil #'equal)))
-         (string-match "curl" user-agent))))
+(defmacro plz-test-get-response (response)
+  "Test parts of RESPONSE with `should'."
+  `(and (should (plz-response-p ,response))
+        (should (numberp (plz-response-version ,response)))
+        (should (eq 200 (plz-response-status ,response)))
+        (should (equal "application/json" (alist-get "Content-Type" 
(plz-response-headers ,response) nil nil #'equal)))
+        (let* ((json (json-read-from-string (plz-response-body ,response)))
+               (headers (alist-get 'headers json))
+               (user-agent (alist-get 'User-Agent headers nil nil #'equal)))
+          (should (string-match "curl" user-agent)))))
 
 ;;;; Tests
 
@@ -93,7 +93,7 @@
                     :then (lambda (response)
                             (setf test-response response)))))
     (plz-test-wait process)
-    (should (plz-test-get-response test-response))))
+    (plz-test-get-response test-response)))
 
 (ert-deftest plz-get-json nil
   (let* ((test-json)
@@ -113,8 +113,8 @@
   (should (string-match "curl" (plz-get-sync "https://httpbin.org/get";))))
 
 (ert-deftest plz-get-response-sync nil
-  (should (plz-test-get-response (plz-get-sync "https://httpbin.org/get";
-                                   :as 'response))))
+  (plz-test-get-response (plz-get-sync "https://httpbin.org/get";
+                           :as 'response)))
 
 (ert-deftest plz-get-json-sync nil
   (let-alist (plz-get-sync "https://httpbin.org/get";



reply via email to

[Prev in Thread] Current Thread [Next in Thread]