emacs-devel
[Top][All Lists]
Advanced

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

[PATCH 1/3] Revert parts of url-auth test


From: Jarno Malmari
Subject: [PATCH 1/3] Revert parts of url-auth test
Date: Thu, 8 Sep 2016 22:51:24 +0300

This reverts some parts of commit f7b0ca9dfabc16cb286265de44a3fbfc3b5e73fa
that introduced QOP and digest test before their implementation.
---
 test/lisp/url/url-auth-tests.el | 37 +++++--------------------------------
 1 file changed, 5 insertions(+), 32 deletions(-)

diff --git a/test/lisp/url/url-auth-tests.el b/test/lisp/url/url-auth-tests.el
index bc30f35..a80349d 100644
--- a/test/lisp/url/url-auth-tests.el
+++ b/test/lisp/url/url-auth-tests.el
@@ -36,18 +36,6 @@ url-auth-test-challenges
 ;; Set explicitly for easier modification for re-runs.
 (setq url-auth-test-challenges
       (list
-       (list :qop "auth"
-             :nonce "uBr3+qkQBybTr/dKWkmpUqVO7SaEwWYzyTKO7g==$"
-             :uri "/random/path"
-             :method "GET"
-             :realm "Some test realm"
-             :cnonce "YWU4NDcxYWMxMDAxMjlkMjAwMDE4MjI5MDAwMGY4NGQ="
-             :nc "00000001"
-             :username "jytky"
-             :password "xi5Ac2HEfKt1lKKO05DCSqsK0u7hqqtsT"
-             :expected-ha1 "af521db3a83abd91262fead04fa31892"
-             :expected-ha2 "e490a6a147c79404b365d1f6059ddda5"
-             :expected-response "ecb6396e93b9e09e31f19264cfd8f854")
        (list :nonce "a1be8a3065e00c5bf190ad499299aea5"
              :opaque "d7c2a27230fc8c74bb6e06be8c9cd189"
              :realm "The Test Realm"
@@ -183,15 +171,9 @@ url-auth-test-challenges
         (should-not auth)))))
 
 (ert-deftest url-auth-test-digest-auth ()
-  "Check common authorization string contents.
-Challenges with qop are not checked for response since a unique
-cnonce is used for generating them which is not mocked by the
-test and cannot be passed by arguments to `url-digest-auth'."
+  "Check common authorization string contents."
   (dolist (challenge url-auth-test-challenges)
-    (let* ((attrs (append
-                   (list (cons "nonce" (plist-get challenge :nonce)))
-                   (if (plist-get challenge :qop)
-                       (list (cons "qop" (plist-get challenge :qop))))))
+    (let* ((attrs (list (cons "nonce" (plist-get challenge :nonce))))
            (url (concat "http://example.org"; (plist-get challenge :uri)))
            url-digest-auth-storage
            auth)
@@ -212,24 +194,15 @@ url-auth-test-challenges
                                   (plist-get challenge :realm) attrs))
       (should auth)
       (should (string-prefix-p "Digest " auth))
+      (should (string-match ".*response=\"\\(.*?\\)\".*" auth))
+      (should (string= (match-string 1 auth)
+                       (plist-get challenge :expected-response)))
       (should (string-match ".*username=\"\\(.*?\\)\".*" auth))
       (should (string= (match-string 1 auth)
                        (plist-get challenge :username)))
       (should (string-match ".*realm=\"\\(.*?\\)\".*" auth))
       (should (string= (match-string 1 auth)
                        (plist-get challenge :realm)))
-
-      (if (plist-member challenge :qop)
-          (progn
-            ;; We don't know these, just check that they exists.
-            (should (string-match-p ".*response=\".*?\".*" auth))
-            ;; url-digest-auth doesn't return these AFAICS.
-;;;            (should (string-match-p ".*nc=\".*?\".*" auth))
-;;;            (should (string-match-p ".*cnonce=\".*?\".*" auth))
-            )
-        (should (string-match ".*response=\"\\(.*?\\)\".*" auth))
-        (should (string= (match-string 1 auth)
-                         (plist-get challenge :expected-response))))
       )))
 
 (ert-deftest url-auth-test-digest-auth-opaque ()
-- 
2.7.0.25.gfc10eb5




reply via email to

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