mirror of
https://github.com/TrentSPalmer/trentpalmerdotorg.git
synced 2024-11-21 17:11:30 -08:00
update accounts/tests/test_edit_profile_view.py add function
test_edit_profile_view_email_already_exists
This commit is contained in:
parent
a9679cff69
commit
9d48b5b0ed
@ -11,6 +11,26 @@ class EditProfileViewTestCase(TestCase):
|
|||||||
user_a.set_password('password123456donkey')
|
user_a.set_password('password123456donkey')
|
||||||
user_a.save()
|
user_a.save()
|
||||||
Account.objects.create(user=user_a)
|
Account.objects.create(user=user_a)
|
||||||
|
User.objects.create(username='user_c', email='user_c@example.com')
|
||||||
|
|
||||||
|
def test_edit_profile_view_email_already_exists(self):
|
||||||
|
self.client.login(username='user_a', password='password123456donkey')
|
||||||
|
response = self.client.post(reverse('accounts:edit_profile'), {
|
||||||
|
'email': 'user_c@example.com',
|
||||||
|
'first_name': 'User_a',
|
||||||
|
'last_name': 'Smith',
|
||||||
|
'twitter_handle': '@user_a',
|
||||||
|
'password': 'password123456donkey',
|
||||||
|
}, follow=True)
|
||||||
|
self.assertEquals(response.status_code, 200)
|
||||||
|
self.assertTemplateUsed(response, 'base_form.html')
|
||||||
|
user_a = User.objects.get(username='user_a')
|
||||||
|
self.assertEquals(user_a.email, 'user_a@example.com')
|
||||||
|
self.assertEquals(user_a.first_name, '')
|
||||||
|
self.assertEquals(user_a.account.twitter_handle, '@Twitter')
|
||||||
|
self.assertEquals(response.request['PATH_INFO'], '/accounts/edit-profile/')
|
||||||
|
msg = "An account already exists with this email address."
|
||||||
|
self.assertEquals(response.content.decode('utf-8').count(msg), 1)
|
||||||
|
|
||||||
def test_edit_profile_view_no_login(self):
|
def test_edit_profile_view_no_login(self):
|
||||||
response = self.client.post(reverse('accounts:edit_profile'), {
|
response = self.client.post(reverse('accounts:edit_profile'), {
|
||||||
|
Loading…
Reference in New Issue
Block a user