1
0
forked from erp-dev/erp

feat: shipment change && version modelize

This commit is contained in:
2026-07-09 23:03:22 +08:00
parent 36e4bb6de6
commit 48e4782e1e
23 changed files with 947 additions and 36 deletions

View File

@@ -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')