mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-26 17:26:10 -06:00
11091 test case for invalid token creation
This commit is contained in:
parent
989d6fda64
commit
adda60ca16
@ -153,6 +153,19 @@ class TokenTest(
|
|||||||
response = self.client.post(url, data, format='json', **self.header)
|
response = self.client.post(url, data, format='json', **self.header)
|
||||||
self.assertEqual(response.status_code, 403)
|
self.assertEqual(response.status_code, 403)
|
||||||
|
|
||||||
|
def test_provision_token_other_user(self):
|
||||||
|
"""
|
||||||
|
Test the behavior of the token provisioning view when invalid credentials are supplied.
|
||||||
|
"""
|
||||||
|
user2 = User.objects.create_user(username='testuser2')
|
||||||
|
data = {
|
||||||
|
'user': user2.id,
|
||||||
|
}
|
||||||
|
url = reverse('users-api:token-list')
|
||||||
|
|
||||||
|
response = self.client.post(url, data, format='json', **self.header)
|
||||||
|
self.assertEqual(response.status_code, 403)
|
||||||
|
|
||||||
|
|
||||||
class ObjectPermissionTest(
|
class ObjectPermissionTest(
|
||||||
# No GraphQL support for ObjectPermission
|
# No GraphQL support for ObjectPermission
|
||||||
|
Loading…
Reference in New Issue
Block a user