You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by je...@apache.org on 2014/09/22 12:27:55 UTC
[14/31] git commit: [#7657] ticket:651 Fix tests failing due to
splitting prefs update controllers
[#7657] ticket:651 Fix tests failing due to splitting prefs update controllers
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/64359721
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/64359721
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/64359721
Branch: refs/heads/je/42cc_7657b
Commit: 6435972165edadd2c46278fa7db4253d5e9af24b
Parents: e8ed733
Author: Igor Bondarenko <je...@gmail.com>
Authored: Tue Sep 16 15:51:36 2014 +0300
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Mon Sep 22 11:14:56 2014 +0300
----------------------------------------------------------------------
Allura/allura/tests/functional/test_auth.py | 36 ++++++++------------
.../allura/tests/functional/test_site_admin.py | 2 +-
2 files changed, 15 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/64359721/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 39f5794..c5be2d4 100644
--- a/Allura/allura/tests/functional/test_auth.py
+++ b/Allura/allura/tests/functional/test_auth.py
@@ -143,9 +143,8 @@ class TestAuth(TestController):
email_address = 'test_abcd_123@domain.net'
user = M.User.query.get(username='test-admin')
addresses_number = len(user.email_addresses)
- self.app.post('/auth/preferences/update',
+ self.app.post('/auth/preferences/update_emails',
params={
- 'preferences.display_name': 'Test Admin',
'new_addr.addr': email_address,
'new_addr.claim': 'Claim Address',
'primary_addr': 'test-admin@users.localhost',
@@ -155,9 +154,8 @@ class TestAuth(TestController):
extra_environ=dict(username='test-admin'))
assert M.EmailAddress.query.find(dict(email=email_address, claimed_by_user_id=user._id)).count() == 1
- r = self.app.post('/auth/preferences/update',
+ r = self.app.post('/auth/preferences/update_emails',
params={
- 'preferences.display_name': 'Test Admin',
'new_addr.addr': email_address,
'new_addr.claim': 'Claim Address',
'primary_addr': 'test-admin@users.localhost',
@@ -182,8 +180,7 @@ class TestAuth(TestController):
# add test@example
with td.audits('New email address: test@example.com', user=True):
- r = self.app.post('/auth/preferences/update', params={
- 'preferences.display_name': 'Test Admin',
+ r = self.app.post('/auth/preferences/update_emails', params={
'new_addr.addr': 'test@example.com',
'new_addr.claim': 'Claim Address',
'primary_addr': 'test-admin@users.localhost',
@@ -197,8 +194,7 @@ class TestAuth(TestController):
# remove test-admin@users.localhost
with td.audits('Email address deleted: test-admin@users.localhost', user=True):
- r = self.app.post('/auth/preferences/update', params={
- 'preferences.display_name': 'Test Admin',
+ r = self.app.post('/auth/preferences/update_emails', params={
'addr-1.ord': '1',
'addr-1.delete': 'on',
'addr-2.ord': '2',
@@ -215,75 +211,71 @@ class TestAuth(TestController):
with td.audits('Display Name changed Test Admin => Admin', user=True):
r = self.app.post('/auth/preferences/update', params={
- 'preferences.display_name': 'Admin',
- 'new_addr.addr': ''},
+ 'preferences.display_name': 'Admin'},
extra_environ=dict(username='test-admin'))
@td.with_user_project('test-admin')
def test_email_prefs_change_requires_password(self):
# Claim new email
new_email_params = {
- 'preferences.display_name': 'Test Admin',
'new_addr.addr': 'test@example.com',
'new_addr.claim': 'Claim Address',
'primary_addr': 'test-admin@users.localhost',
}
- r = self.app.post('/auth/preferences/update', params=new_email_params,
+ r = self.app.post('/auth/preferences/update_emails', params=new_email_params,
extra_environ=dict(username='test-admin'))
assert_in('You must provide your current password to claim new email', self.webflash(r))
assert_not_in('test@example.com', r.follow())
new_email_params['password'] = 'bad pass'
- r = self.app.post('/auth/preferences/update', params=new_email_params,
+ r = self.app.post('/auth/preferences/update_emails', params=new_email_params,
extra_environ=dict(username='test-admin'))
assert_in('You must provide your current password to claim new email', self.webflash(r))
assert_not_in('test@example.com', r.follow())
new_email_params['password'] = 'foo' # valid password
- r = self.app.post('/auth/preferences/update', params=new_email_params,
+ r = self.app.post('/auth/preferences/update_emails', params=new_email_params,
extra_environ=dict(username='test-admin'))
assert_not_in('You must provide your current password to claim new email', self.webflash(r))
assert_in('test@example.com', r.follow())
# Change primary address
change_primary_params = {
- 'preferences.display_name': 'Test Admin',
'new_addr.addr': '',
'primary_addr': 'test@example.com',
}
- r = self.app.post('/auth/preferences/update', params=change_primary_params,
+ r = self.app.post('/auth/preferences/update_emails', params=change_primary_params,
extra_environ=dict(username='test-admin'))
assert_in('You must provide your current password to change primary address', self.webflash(r))
assert_equal(M.User.by_username('test-admin').get_pref('email_address'), 'test-admin@users.localhost')
change_primary_params['password'] = 'bad pass'
- r = self.app.post('/auth/preferences/update', params=change_primary_params,
+ r = self.app.post('/auth/preferences/update_emails', params=change_primary_params,
extra_environ=dict(username='test-admin'))
assert_in('You must provide your current password to change primary address', self.webflash(r))
assert_equal(M.User.by_username('test-admin').get_pref('email_address'), 'test-admin@users.localhost')
change_primary_params['password'] = 'foo' # valid password
- r = self.app.post('/auth/preferences/update', params=change_primary_params,
+ r = self.app.post('/auth/preferences/update_emails', params=change_primary_params,
extra_environ=dict(username='test-admin'))
assert_not_in('You must provide your current password to change primary address', self.webflash(r))
assert_equal(M.User.by_username('test-admin').get_pref('email_address'), 'test@example.com')
# Remove email
remove_email_params = {
- 'preferences.display_name': 'Test Admin',
'addr-1.ord': '1',
'addr-2.ord': '2',
'addr-2.delete': 'on',
'new_addr.addr': '',
'primary_addr': 'test-admin@users.localhost',
}
- r = self.app.post('/auth/preferences/update', params=remove_email_params,
+ r = self.app.post('/auth/preferences/update_emails', params=remove_email_params,
extra_environ=dict(username='test-admin'))
assert_in('You must provide your current password to delete an email', self.webflash(r))
assert_in('test@example.com', r.follow())
remove_email_params['password'] = 'bad pass'
- r = self.app.post('/auth/preferences/update', params=remove_email_params,
+ r = self.app.post('/auth/preferences/update_emails', params=remove_email_params,
extra_environ=dict(username='test-admin'))
assert_in('You must provide your current password to delete an email', self.webflash(r))
assert_in('test@example.com', r.follow())
remove_email_params['password'] = 'foo' # vallid password
- r = self.app.post('/auth/preferences/update', params=remove_email_params,
+ r = self.app.post('/auth/preferences/update_emails', params=remove_email_params,
extra_environ=dict(username='test-admin'))
assert_not_in('You must provide your current password to delete an email', self.webflash(r))
assert_not_in('test@example.com', r.follow())
http://git-wip-us.apache.org/repos/asf/allura/blob/64359721/Allura/allura/tests/functional/test_site_admin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_site_admin.py b/Allura/allura/tests/functional/test_site_admin.py
index d51ffc9..02436eb 100644
--- a/Allura/allura/tests/functional/test_site_admin.py
+++ b/Allura/allura/tests/functional/test_site_admin.py
@@ -380,7 +380,7 @@ class TestUserDetails(TestController):
def test_add_comment(self):
r = self.app.get('/nf/admin/user/test-user')
assert_not_in(u'Comment by test-admin: I was hêre!', r)
- form = r.forms[1]
+ form = r.forms[2]
assert_equal(form['username'].value, 'test-user')
form['comment'] = u'I was hêre!'
r = form.submit()