-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_authentication.py
More file actions
32 lines (28 loc) · 893 Bytes
/
test_authentication.py
File metadata and controls
32 lines (28 loc) · 893 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
31
32
import django.test
import django.urls
import rest_framework.status
import rest_framework.test
import user.models
import user.tests.auth.base
class AuthenticationTests(user.tests.auth.base.BaseAuthTestCase):
def test_signin_success(self):
user.models.User.objects.create_user(
email='minecraft.digger@gmail.com',
name='Steve',
surname='Jobs',
password='SuperStrongPassword2000!',
other={'age': 23, 'country': 'gb'},
)
data = {
'email': 'minecraft.digger@gmail.com',
'password': 'SuperStrongPassword2000!',
}
response = self.client.post(
django.urls.reverse('api-user:sign-in'),
data,
format='json',
)
self.assertEqual(
response.status_code,
rest_framework.status.HTTP_200_OK,
)