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:
Reza authored and GitHub committed 2025-10-01 16:23:35 +10:00
1 parent 3527e1a359
commit 40700dfbcf
4 files changed
+136 -38

No files matched your search

+22
View File
@@ -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)