|
@@ -119,13 +119,13 @@ class ProjectViewTest(PermissionTestMixi
|
|
|
# Fetch context data from response.
|
|
|
location, entities = response.context_data["location_entities"][0]
|
|
|
|
|
|
# Set-up expected context data values.
|
|
|
expected_entities = ["<Entity: Test Entity 1 (Test Project 1 - Test Location 1)>",
|
|
|
"<Entity: Test Entity 2 (Test Project 1 - Test Location 1)>"]
|
|
|
|
|
|
|
|
|
# Validate context data.
|
|
|
self.assertEqual(location.name, "Test Location 1")
|
|
|
self.assertQuerysetEqual(entities, expected_entities)
|
|
|
|
|
|
# Fetch context data from response.
|
|
|
location, entities = response.context_data["location_entities"][1]
|
|
@@ -171,13 +171,12 @@ class EntityViewTest(PermissionTestMixin
|
|
|
|
|
|
expected_outgoing_communications = ["<Communication: Test Entity 1 -> Test Entity 2 (UDP:123)>",
|
|
|
"<Communication: Test Entity 1 -> Test Entity 3 (UDP:53)>"]
|
|
|
|
|
|
expected_interfaces = ["<Interface: Test Entity 1 (192.168.1.1)>"]
|
|
|
|
|
|
|
|
|
# Validate the response.
|
|
|
self.assertQuerysetEqual(response.context_data["interfaces"], expected_interfaces)
|
|
|
self.assertQuerysetEqual(response.context_data["incoming_communications"], expected_incoming_communications)
|
|
|
self.assertQuerysetEqual(response.context_data["outgoing_communications"], expected_outgoing_communications)
|
|
|
self.assertEqual(response.context_data["entity"], expected_entity)
|
|
|
self.assertTrue("entity_iptables" in response.context_data)
|
|
@@ -482,13 +481,13 @@ class ProjectDeleteViewTest(PermissionTe
|
|
|
|
|
|
|
|
|
class LocationCreateViewTest(PermissionTestMixin, TestCase):
|
|
|
|
|
|
view_class = LocationCreateView
|
|
|
sufficient_permissions = ("add_location",)
|
|
|
|
|
|
|
|
|
def test_form_styling(self):
|
|
|
"""
|
|
|
Tests if proper form styling is being applied.
|
|
|
"""
|
|
|
|
|
|
# Get the view.
|
|
@@ -498,13 +497,13 @@ class LocationCreateViewTest(PermissionT
|
|
|
response = generate_get_response(view)
|
|
|
|
|
|
self.assertContains(response, 'class="span6 textinput')
|
|
|
self.assertContains(response, 'class="span6 textarea')
|
|
|
self.assertContains(response, 'placeholder="New Location"')
|
|
|
self.assertContains(response, 'placeholder="Description for new location."')
|
|
|
|
|
|
|
|
|
|
|
|
class LocationUpdateViewTest(PermissionTestMixin, TestCase):
|
|
|
|
|
|
fixtures = ['test-data.json']
|
|
|
|
|
|
view_class = LocationUpdateView
|