mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-13 02:58:17 -06:00
Update tests
This commit is contained in:
parent
79751db587
commit
d8d665ecd9
@ -42,6 +42,7 @@ class PluginTest(TestCase):
|
|||||||
url = reverse('admin:dummy_plugin_dummymodel_add')
|
url = reverse('admin:dummy_plugin_dummymodel_add')
|
||||||
self.assertEqual(url, '/admin/dummy_plugin/dummymodel/add/')
|
self.assertEqual(url, '/admin/dummy_plugin/dummymodel/add/')
|
||||||
|
|
||||||
|
@override_settings(LOGIN_REQUIRED=False)
|
||||||
def test_views(self):
|
def test_views(self):
|
||||||
|
|
||||||
# Test URL resolution
|
# Test URL resolution
|
||||||
@ -53,7 +54,7 @@ class PluginTest(TestCase):
|
|||||||
response = client.get(url)
|
response = client.get(url)
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
||||||
@override_settings(EXEMPT_VIEW_PERMISSIONS=['*'])
|
@override_settings(EXEMPT_VIEW_PERMISSIONS=['*'], LOGIN_REQUIRED=False)
|
||||||
def test_api_views(self):
|
def test_api_views(self):
|
||||||
|
|
||||||
# Test URL resolution
|
# Test URL resolution
|
||||||
@ -65,6 +66,7 @@ class PluginTest(TestCase):
|
|||||||
response = client.get(url)
|
response = client.get(url)
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
||||||
|
@override_settings(LOGIN_REQUIRED=False)
|
||||||
def test_registered_views(self):
|
def test_registered_views(self):
|
||||||
|
|
||||||
# Test URL resolution
|
# Test URL resolution
|
||||||
|
@ -73,7 +73,7 @@ class APIViewTestCases:
|
|||||||
|
|
||||||
class GetObjectViewTestCase(APITestCase):
|
class GetObjectViewTestCase(APITestCase):
|
||||||
|
|
||||||
@override_settings(EXEMPT_VIEW_PERMISSIONS=['*'])
|
@override_settings(EXEMPT_VIEW_PERMISSIONS=['*'], LOGIN_REQUIRED=False)
|
||||||
def test_get_object_anonymous(self):
|
def test_get_object_anonymous(self):
|
||||||
"""
|
"""
|
||||||
GET a single object as an unauthenticated user.
|
GET a single object as an unauthenticated user.
|
||||||
@ -135,7 +135,7 @@ class APIViewTestCases:
|
|||||||
class ListObjectsViewTestCase(APITestCase):
|
class ListObjectsViewTestCase(APITestCase):
|
||||||
brief_fields = []
|
brief_fields = []
|
||||||
|
|
||||||
@override_settings(EXEMPT_VIEW_PERMISSIONS=['*'])
|
@override_settings(EXEMPT_VIEW_PERMISSIONS=['*'], LOGIN_REQUIRED=False)
|
||||||
def test_list_objects_anonymous(self):
|
def test_list_objects_anonymous(self):
|
||||||
"""
|
"""
|
||||||
GET a list of objects as an unauthenticated user.
|
GET a list of objects as an unauthenticated user.
|
||||||
|
@ -62,7 +62,7 @@ class ViewTestCases:
|
|||||||
"""
|
"""
|
||||||
Retrieve a single instance.
|
Retrieve a single instance.
|
||||||
"""
|
"""
|
||||||
@override_settings(EXEMPT_VIEW_PERMISSIONS=['*'])
|
@override_settings(EXEMPT_VIEW_PERMISSIONS=['*'], LOGIN_REQUIRED=False)
|
||||||
def test_get_object_anonymous(self):
|
def test_get_object_anonymous(self):
|
||||||
# Make the request as an unauthenticated user
|
# Make the request as an unauthenticated user
|
||||||
self.client.logout()
|
self.client.logout()
|
||||||
@ -421,7 +421,7 @@ class ViewTestCases:
|
|||||||
"""
|
"""
|
||||||
Retrieve multiple instances.
|
Retrieve multiple instances.
|
||||||
"""
|
"""
|
||||||
@override_settings(EXEMPT_VIEW_PERMISSIONS=['*'])
|
@override_settings(EXEMPT_VIEW_PERMISSIONS=['*'], LOGIN_REQUIRED=False)
|
||||||
def test_list_objects_anonymous(self):
|
def test_list_objects_anonymous(self):
|
||||||
# Make the request as an unauthenticated user
|
# Make the request as an unauthenticated user
|
||||||
self.client.logout()
|
self.client.logout()
|
||||||
|
Loading…
Reference in New Issue
Block a user