-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_registration.py
More file actions
30 lines (27 loc) · 843 Bytes
/
test_registration.py
File metadata and controls
30 lines (27 loc) · 843 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import rest_framework.status
import rest_framework.test
import user.models
import user.tests.auth.base
class RegistrationTests(user.tests.auth.base.BaseAuthTestCase):
def test_registration_success(self):
valid_data = {
'name': 'Emma',
'surname': 'Thompson',
'email': 'example@gmail.com',
'password': 'SuperStrongPassword2000!',
'other': {'age': 23, 'country': 'us'},
}
response = self.client.post(
self.signup_url,
valid_data,
format='json',
)
self.assertEqual(
response.status_code,
rest_framework.status.HTTP_200_OK,
)
self.assertTrue(
user.models.User.objects.filter(
email='example@gmail.com',
).exists(),
)