Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#2370] add reset for reset_key on successful password change
Adapted for this branch tests
- Loading branch information
Showing
2 changed files
with
29 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from nose.tools import assert_true, assert_false | ||
|
||
from routes import url_for | ||
|
||
import ckan.new_tests.helpers as helpers | ||
import ckan.new_tests.factories as factories | ||
from ckan.lib.mailer import create_reset_key | ||
|
||
|
||
class TestPackageControllerNew(helpers.FunctionalTestBase): | ||
|
||
def test_perform_reset_for_key_change(self): | ||
password = 'password' | ||
params = {'password1': password, 'password2': password} | ||
user = factories.User() | ||
user_obj = helpers.model.User.by_name(user['name']) | ||
create_reset_key(user_obj) | ||
key = user_obj.reset_key | ||
|
||
app = self._get_test_app() | ||
offset = url_for(controller='user', | ||
action='perform_reset', | ||
id=user_obj.id, | ||
key=user_obj.reset_key) | ||
response = app.post(offset, params=params, status=302) | ||
user_obj = helpers.model.User.by_name(user['name']) # Update user_obj | ||
|
||
assert_true(key != user_obj.reset_key) |