add base test for route 'employees'
This commit is contained in:
parent
fd0a491e89
commit
4e47a5b7a4
|
|
@ -1,3 +1,32 @@
|
||||||
from django.test import TestCase
|
from rest_framework.test import APITestCase, APIClient
|
||||||
|
from account.models import User
|
||||||
|
from rest_framework import status
|
||||||
# Create your tests here.
|
# Create your tests here.
|
||||||
|
|
||||||
|
|
||||||
|
class BaseTestCase(APITestCase):
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
self.username = 'sedragurda'
|
||||||
|
self.password = 'sedragurdaredips19'
|
||||||
|
self.email = 'sedragurda@desoz.com'
|
||||||
|
self.newsletter = True
|
||||||
|
self.user = User.objects.create_user(username=self.username, email=self.email, password=self.password)
|
||||||
|
|
||||||
|
|
||||||
|
class EmployeeTests(BaseTestCase):
|
||||||
|
def test_employee_create(self):
|
||||||
|
self.data ={
|
||||||
|
'username_or_email': 'sedragurda',
|
||||||
|
'password': 'sedragurdaredips19',
|
||||||
|
'remember': True
|
||||||
|
}
|
||||||
|
|
||||||
|
response = self.client.post('/api/auth/login/',data=self.data)
|
||||||
|
|
||||||
|
auth = {
|
||||||
|
'access_token': response.data['access_token'],
|
||||||
|
'refresh_token': response.data['refresh_token']
|
||||||
|
}
|
||||||
|
response = self.client.get('/api/back/establishments/employees/', data=auth, format='json')
|
||||||
|
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||||
Loading…
Reference in New Issue
Block a user