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/06 14:50:39 UTC
[06/10] allura git commit: [#8117] fix tests,
now that there are 2 forms on the page
[#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/9ecc6260
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/9ecc6260
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/9ecc6260
Branch: refs/heads/master
Commit: 9ecc62604942315a57c4a165c9be06f52b0ee782
Parents: 7eb55e0
Author: Dave Brondsema <da...@brondsema.net>
Authored: Thu Sep 1 13:54:29 2016 -0400
Committer: Dave Brondsema <da...@brondsema.net>
Committed: Tue Sep 6 10:38:52 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/9ecc6260/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/9ecc6260/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))