forked from erp-dev/erp
feat: shipment change && version modelize
This commit is contained in:
@@ -11,6 +11,7 @@ from flower.error_code import AuthErrorCode
|
||||
class AuthLoginAPITestCase(TestCase):
|
||||
def setUp(self):
|
||||
self.url = '/api/auth/login/'
|
||||
self.refresh_url = '/api/auth/refresh/'
|
||||
self.client = APIClient()
|
||||
self.merchant = Merchant.objects.create(name='登录商户', type=MerchantTypeEnum.FACTORY)
|
||||
|
||||
@@ -45,6 +46,23 @@ class AuthLoginAPITestCase(TestCase):
|
||||
self.assertIn('access', response.data)
|
||||
self.assertIn('refresh', response.data)
|
||||
|
||||
def test_refresh_token_returns_new_access_token(self):
|
||||
self._create_user_with_employee(username='refresh_user', password='pass12345')
|
||||
login_response = self.client.post(
|
||||
self.url,
|
||||
{'username': 'refresh_user', 'password': 'pass12345'},
|
||||
format='json',
|
||||
)
|
||||
|
||||
response = self.client.post(
|
||||
self.refresh_url,
|
||||
{'refresh': login_response.data['refresh']},
|
||||
format='json',
|
||||
)
|
||||
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
self.assertIn('access', response.data)
|
||||
|
||||
def test_login_requires_username_and_password(self):
|
||||
response = self.client.post(self.url, {}, format='json')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user