mirror of
https://github.com/inventree/InvenTree.git
synced 2026-11-25 01:03:07 +00:00
Prevent delete operation on /api/user/me/ (#12770)
* Prevent delete operation on /api/user/me/ * Bump API version
This commit is contained in:
1 parent
8c1c16e59a
commit
aadd27d217
3 files changed
+16
-1
No files matched your search
@@ -335,6 +335,15 @@ class UserAPITests(InvenTreeAPITestCase):
|
||||
# User cannot fetch their own details if they are not active
|
||||
response = self.get(url, expected_code=401)
|
||||
|
||||
def test_me_endpoint_delete_is_blocked(self):
|
||||
"""A user must not be able to delete their own account via '/api/user/me/'."""
|
||||
url = reverse('api-user-me')
|
||||
pk = self.user.pk
|
||||
|
||||
self.delete(url, expected_code=405)
|
||||
|
||||
self.assertTrue(User.objects.filter(pk=pk).exists())
|
||||
|
||||
|
||||
class SuperuserAPITests(InvenTreeAPITestCase):
|
||||
"""Tests for user API endpoints that require superuser rights."""
|
||||
|
||||
Reference in new issue
Block a user