You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2016/09/01 17:54:36 UTC

allura git commit: [#8117] fix tests, now that there are 2 forms on the page

Repository: allura
Updated Branches:
  refs/heads/db/8117 a8d198013 -> c52af997f


[#8117] fix tests, now that there are 2 forms on the page


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/c52af997
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/c52af997
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/c52af997

Branch: refs/heads/db/8117
Commit: c52af997fc2a6b9c29cbf945720f51fadc84e296
Parents: a8d1980
Author: Dave Brondsema <da...@brondsema.net>
Authored: Thu Sep 1 13:54:29 2016 -0400
Committer: Dave Brondsema <da...@brondsema.net>
Committed: Thu Sep 1 13:54:29 2016 -0400

----------------------------------------------------------------------
 Allura/allura/templates/user_totp.html      |  2 +-
 Allura/allura/tests/functional/test_auth.py | 20 ++++++++++++--------
 2 files changed, 13 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/c52af997/Allura/allura/templates/user_totp.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/user_totp.html b/Allura/allura/templates/user_totp.html
index 53bc928..c404857 100644
--- a/Allura/allura/templates/user_totp.html
+++ b/Allura/allura/templates/user_totp.html
@@ -49,7 +49,7 @@
 
     {% if setup %}
         <h2>Enter the code</h2>
-        <form method="POST" action="totp_set">
+        <form method="POST" action="totp_set" id="totp_set">
         <p>
             Enter the {{ config['auth.multifactor.totp.length'] }}-digit code to confirm it is set up correctly:<br>
             {% if c.form_errors['code'] %}

http://git-wip-us.apache.org/repos/asf/allura/blob/c52af997/Allura/allura/tests/functional/test_auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_auth.py b/Allura/allura/tests/functional/test_auth.py
index 0e0da43..261b956 100644
--- a/Allura/allura/tests/functional/test_auth.py
+++ b/Allura/allura/tests/functional/test_auth.py
@@ -2060,16 +2060,18 @@ class TestTwoFactor(TestController):
         first_key_shown = r.session['totp_new_key']
 
         with audits('Failed to set up multifactor TOTP \(wrong code\)', user=True):
-            r.form['code'] = ''
-            r = r.form.submit()
+            form = r.forms['totp_set']
+            form['code'] = ''
+            r = form.submit()
             assert_in('Invalid', r)
             assert_equal(first_key_shown, r.session['totp_new_key'])  # different keys on each pageload would be bad!
 
         new_totp = TotpService().Totp(r.session['totp_new_key'])
         code = new_totp.generate(time_time())
-        r.form['code'] = code
+        form = r.forms['totp_set']
+        form['code'] = code
         with audits('Set up multifactor TOTP', user=True):
-            r = r.form.submit()
+            r = form.submit()
             assert_equal('Two factor authentication has now been set up.', json.loads(self.webflash(r))['message'],
                          self.webflash(r))
 
@@ -2096,8 +2098,9 @@ class TestTwoFactor(TestController):
         assert_equal(self.sample_key, current_key)
 
         # incorrect submission
-        r.form['code'] = ''
-        r = r.form.submit()
+        form = r.forms['totp_set']
+        form['code'] = ''
+        r = form.submit()
         assert_in('Invalid', r)
 
         # still unchanged key
@@ -2108,8 +2111,9 @@ class TestTwoFactor(TestController):
         new_key = r.session['totp_new_key']
         new_totp = TotpService().Totp(new_key)
         code = new_totp.generate(time_time())
-        r.form['code'] = code
-        r = r.form.submit()
+        form = r.forms['totp_set']
+        form['code'] = code
+        r = form.submit()
         assert_equal('Two factor authentication has now been set up.', json.loads(self.webflash(r))['message'],
                      self.webflash(r))