Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fanjinfei committed Apr 6, 2017
1 parent 2348866 commit 07f96e2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
8 changes: 0 additions & 8 deletions ckan/controllers/user.py
Expand Up @@ -349,14 +349,6 @@ def _save_edit(self, id, context):

email_changed = data_dict['email'] != c.userobj.email

if id != data_dict['name']:
old_user = model.User.get(id)
if old_user.name != data_dict['name']:
errors = {'username': [_('Can not modify username')]}
error_summary = {_('Username'):
_('Can not modify username')}
return self.edit(id, data_dict, errors, error_summary)

if (data_dict['password1'] and data_dict['password2']) \
or email_changed:
identity = {'login': c.user,
Expand Down
6 changes: 3 additions & 3 deletions ckan/tests/controllers/test_user.py
Expand Up @@ -347,7 +347,7 @@ def test_edit_user_logged_in_username_change(self):
form['name'] = 'new-name'
env = {'REMOTE_USER': user['name'].encode('ascii')}
response = webtest_submit(form, 'save', status=200, extra_environ=env)
assert_true('Can not modify username' in response)
assert_true('That login name can not be modified' in response)

def test_edit_user_logged_in_username_change_by_name(self):
user_pass = 'pass'
Expand Down Expand Up @@ -376,7 +376,7 @@ def test_edit_user_logged_in_username_change_by_name(self):
form['name'] = 'new-name'
env = {'REMOTE_USER': user['name'].encode('ascii')}
response = webtest_submit(form, 'save', status=200, extra_environ=env)
assert_true('Can not modify username' in response)
assert_true('That login name can not be modified' in response)

def test_edit_user_logged_in_username_change_by_id(self):
user_pass = 'pass'
Expand Down Expand Up @@ -405,7 +405,7 @@ def test_edit_user_logged_in_username_change_by_id(self):
form['name'] = 'new-name'
env = {'REMOTE_USER': user['name'].encode('ascii')}
response = webtest_submit(form, 'save', status=200, extra_environ=env)
assert_true('Can not modify username' in response)
assert_true('That login name can not be modified' in response)

def test_perform_reset_for_key_change(self):
password = 'password'
Expand Down

0 comments on commit 07f96e2

Please sign in to comment.