modified change_pass tests
This commit is contained in:
parent
39aa1db4d6
commit
eb396abc4a
@ -14,6 +14,7 @@
|
|||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import urlparse
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from mediagoblin import mg_globals
|
from mediagoblin import mg_globals
|
||||||
@ -60,16 +61,17 @@ class TestUserEdit(object):
|
|||||||
self.login(test_app)
|
self.login(test_app)
|
||||||
|
|
||||||
# test that the password can be changed
|
# test that the password can be changed
|
||||||
# template.clear_test_template_context()
|
template.clear_test_template_context()
|
||||||
res = test_app.post(
|
res = test_app.post(
|
||||||
'/edit/account/', {
|
'/edit/password/', {
|
||||||
'old_password': 'toast',
|
'old_password': 'toast',
|
||||||
'new_password': '123456',
|
'new_password': '123456',
|
||||||
'wants_comment_notification': 'y'
|
|
||||||
})
|
})
|
||||||
|
res.follow()
|
||||||
|
|
||||||
|
# Did we redirect to the correct page?
|
||||||
|
assert urlparse.urlsplit(res.location)[2] == '/edit/account/'
|
||||||
|
|
||||||
# Check for redirect on success
|
|
||||||
assert res.status_int == 302
|
|
||||||
# test_user has to be fetched again in order to have the current values
|
# test_user has to be fetched again in order to have the current values
|
||||||
test_user = User.query.filter_by(username=u'chris').first()
|
test_user = User.query.filter_by(username=u'chris').first()
|
||||||
assert bcrypt_check_password('123456', test_user.pw_hash)
|
assert bcrypt_check_password('123456', test_user.pw_hash)
|
||||||
@ -77,9 +79,10 @@ class TestUserEdit(object):
|
|||||||
self.user_password = '123456'
|
self.user_password = '123456'
|
||||||
|
|
||||||
# test that the password cannot be changed if the given
|
# test that the password cannot be changed if the given
|
||||||
# old_password is wrong template.clear_test_template_context()
|
# old_password is wrong
|
||||||
|
template.clear_test_template_context()
|
||||||
test_app.post(
|
test_app.post(
|
||||||
'/edit/account/', {
|
'/edit/password/', {
|
||||||
'old_password': 'toast',
|
'old_password': 'toast',
|
||||||
'new_password': '098765',
|
'new_password': '098765',
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user