-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_authentication.py
More file actions
33 lines (29 loc) · 1.04 KB
/
test_authentication.py
File metadata and controls
33 lines (29 loc) · 1.04 KB
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
33
import rest_framework.status
import business.models
import business.tests.auth.base
class AuthenticationTests(business.tests.auth.base.BaseBusinessAuthTestCase):
def test_signin_success(self):
registration_data = {**self.valid_data, 'email': 'unique@company.com'}
business.models.Company.objects.create_company(
name=registration_data['name'],
email=registration_data['email'],
password=registration_data['password'],
)
self.assertTrue(
business.models.Company.objects.filter(
email=registration_data['email'],
).exists(),
)
response = self.client.post(
self.company_signin_url,
{
'email': registration_data['email'],
'password': registration_data['password'],
},
format='json',
)
self.assertEqual(
response.status_code,
rest_framework.status.HTTP_200_OK,
)
self.assertIn('access', response.data)