mirror of
https://github.com/inventree/InvenTree.git
synced 2026-11-24 16:57:30 +00:00
Refactor API endpoint: Users (1/6) (#10437)
* Enhance Owner model filtering with optimized search and active status filtersI * enhance output options for Group API endpoints and add tests for GroupDetail * update api_version
This commit is contained in:
4 files changed
+136
-38
No files matched your search
@@ -395,3 +395,25 @@ class UserTokenTests(InvenTreeAPITestCase):
|
||||
# Get token without auth (should fail)
|
||||
self.client.logout()
|
||||
self.get(reverse('api-token'), expected_code=401)
|
||||
|
||||
|
||||
class GroupDetialTests(InvenTreeAPITestCase):
|
||||
"""Tests for the GroupDetail API endpoint."""
|
||||
|
||||
fixtures = ['users']
|
||||
|
||||
def test_group_list(self):
|
||||
"""Test the GroupDetail API endpoint."""
|
||||
url = reverse('api-group-detail', kwargs={'pk': 1})
|
||||
|
||||
response = self.get(url, {'user_detail': 'true'}, expected_code=200)
|
||||
self.assertIn('users', response.data)
|
||||
|
||||
response = self.get(url, {'role_detail': 'true'}, expected_code=200)
|
||||
self.assertIn('roles', response.data)
|
||||
|
||||
response = self.get(url, {'permission_detail': 'true'}, expected_code=200)
|
||||
self.assertIn('permissions', response.data)
|
||||
|
||||
response = self.get(url, {'permission_detail': 'false'}, expected_code=200)
|
||||
self.assertNotIn('permissions', response.data)
|
||||
Reference in new issue
Block a user