|
@@ -154,13 +154,13 @@ class ProjectViewTest(ViewTest):
|
|
|
self.assertEqual(str(response.context["project"]), "Test Project 1")
|
|
|
self.assertContains(response, "Test Project 1")
|
|
|
self.assertContains(response, "Test Location 1")
|
|
|
self.assertContains(response, "Test Location 2")
|
|
|
|
|
|
|
|
|
class EntityView(ViewTest):
|
|
|
class EntityViewTest(ViewTest):
|
|
|
|
|
|
def test_permission_denied(self):
|
|
|
"""
|
|
|
Tests if permission will be denied for client without sufficient privileges.
|
|
|
"""
|
|
|
|
|
@@ -187,12 +187,25 @@ class EntityView(ViewTest):
|
|
|
"""
|
|
|
|
|
|
self.client.login(username="fullperms", password="fullperms")
|
|
|
|
|
|
response = self.client.get(reverse("entity", args=(1,)))
|
|
|
|
|
|
expected_incoming_communications = ["<Communication: Test Entity 2 -> Test Entity 1 (TCP:22)>",
|
|
|
"<Communication: Test Entity 2 -> Test Entity 1 (ICMP:8)>",
|
|
|
"<Communication: Test Entity 3 -> Test Entity 1 (TCP:3306)>",
|
|
|
"<Communication: Test Subnet -> Test Entity 1 (TCP:22)>",]
|
|
|
|
|
|
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)>"]
|
|
|
|
|
|
self.assertQuerysetEqual(response.context["interfaces"], expected_interfaces)
|
|
|
self.assertQuerysetEqual(response.context["incoming_communications"], expected_incoming_communications)
|
|
|
self.assertQuerysetEqual(response.context["outgoing_communications"], expected_outgoing_communications)
|
|
|
self.assertEqual(str(response.context["entity"]), "Test Entity 1 (Test Project 1 - Test Location 1)")
|
|
|
self.assertContains(response, "Test Entity 1")
|
|
|
self.assertContains(response, ":INPUT")
|
|
|
self.assertContains(response, ":OUTPUT")
|
|
|
self.assertContains(response, ":FORWARD")
|
|
|
|