fix tests to use new change_email view

This commit is contained in:
Rodney Ewing 2013-07-12 12:34:35 -07:00
parent 5a6e4e1307
commit 4710097b27

View File

@ -147,26 +147,26 @@ class TestUserEdit(object):
# Test email already in db # Test email already in db
template.clear_test_template_context() template.clear_test_template_context()
test_app.post( test_app.post(
'/edit/account/', { '/edit/email/', {
'new_email': 'chris@example.com', 'new_email': 'chris@example.com',
'password': 'toast'}) 'password': 'toast'})
# Check form errors # Check form errors
context = template.TEMPLATE_TEST_CONTEXT[ context = template.TEMPLATE_TEST_CONTEXT[
'mediagoblin/edit/edit_account.html'] 'mediagoblin/edit/change_email.html']
assert context['form'].new_email.errors == [ assert context['form'].new_email.errors == [
u'Sorry, a user with that email address already exists.'] u'Sorry, a user with that email address already exists.']
# Test successful email change # Test successful email change
template.clear_test_template_context() template.clear_test_template_context()
res = test_app.post( res = test_app.post(
'/edit/account/', { '/edit/email/', {
'new_email': 'new@example.com', 'new_email': 'new@example.com',
'password': 'toast'}) 'password': 'toast'})
res.follow() res.follow()
# Correct redirect? # Correct redirect?
assert urlparse.urlsplit(res.location)[2] == '/u/chris/' assert urlparse.urlsplit(res.location)[2] == '/edit/account/'
# Make sure we get email verification and try verifying # Make sure we get email verification and try verifying
assert len(mail.EMAIL_TEST_INBOX) == 1 assert len(mail.EMAIL_TEST_INBOX) == 1