snapshot: preserve account profile inline editing and avatar flow
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
from django.contrib.auth import get_user_model
|
||||
from django.test import Client, TestCase
|
||||
|
||||
from workflows.models import UserProfile
|
||||
|
||||
|
||||
class AccountUISmokeTests(TestCase):
|
||||
def setUp(self):
|
||||
@@ -24,3 +26,32 @@ class AccountUISmokeTests(TestCase):
|
||||
response = self.client.get('/accounts/password_change/', HTTP_HOST='localhost')
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertContains(response, 'Aktuelles Passwort')
|
||||
|
||||
def test_user_profile_is_created_automatically(self):
|
||||
self.assertTrue(UserProfile.objects.filter(user=self.user).exists())
|
||||
|
||||
def test_account_profile_details_can_be_updated(self):
|
||||
response = self.client.post(
|
||||
'/account/',
|
||||
{
|
||||
'account_form': 'details',
|
||||
'first_name': 'Updated',
|
||||
'last_name': 'User',
|
||||
'email': 'updated@example.com',
|
||||
'phone_number': '030 123456',
|
||||
'mobile_number': '0176 123456',
|
||||
'job_title': 'IT Manager',
|
||||
'department': 'IT',
|
||||
'location': 'Berlin',
|
||||
'contact_notes': 'Available in the mornings',
|
||||
},
|
||||
HTTP_HOST='localhost',
|
||||
follow=True,
|
||||
)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.user.refresh_from_db()
|
||||
profile = self.user.profile
|
||||
self.assertEqual(self.user.first_name, 'Updated')
|
||||
self.assertEqual(self.user.email, 'updated@example.com')
|
||||
self.assertEqual(profile.phone_number, '030 123456')
|
||||
self.assertEqual(profile.job_title, 'IT Manager')
|
||||
|
||||
Reference in New Issue
Block a user