Skip to content

Commit

Permalink
added some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Zharktas committed Mar 10, 2016
1 parent 157174f commit f4c31b2
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions ckan/tests/controllers/test_user.py
Expand Up @@ -246,6 +246,37 @@ def test_edit_user(self):
assert_equal(user.about, 'new about')
assert_equal(user.activity_streams_email_notifications, True)

def test_email_change_without_password(self):

app = self._get_test_app()
env, response, user = _get_user_edit_page(app)

form = response.forms['user-edit-form']

# new values
form['email'] = 'new@example.com'

# factory returns user with password 'pass'
form.fields['old_password'][0].value = 'wrong-pass'

response = webtest_submit(form, 'save', status=200, extra_environ=env)
assert_true('Old Password: incorrect password' in response)

def test_email_change_with_password(self):
app = self._get_test_app()
env, response, user = _get_user_edit_page(app)

form = response.forms['user-edit-form']

# new values
form['email'] = 'new@example.com'

# factory returns user with password 'pass'
form.fields['old_password'][0].value = 'pass'

response = submit_and_follow(app, form, env, 'save')
assert_true('Profile updated' in response)

def test_perform_reset_for_key_change(self):
password = 'password'
params = {'password1': password, 'password2': password}
Expand Down

0 comments on commit f4c31b2

Please sign in to comment.