|
@@ -75,7 +75,7 @@ class IndexViewTest(ViewTest):
|
|
|
self.client.login(username="fullperms", password="fullperms")
|
|
|
|
|
|
response = self.client.get(reverse("index"))
|
|
|
|
|
|
|
|
|
self.assertQuerysetEqual(response.context["projects"], ["<Project: Test Project 1>", "<Project: Test Project 2>"])
|
|
|
self.assertContains(response, "Test Project 1")
|
|
|
self.assertContains(response, "Test Project 2")
|
|
@@ -131,7 +131,7 @@ class ProjectViewTest(ViewTest):
|
|
|
|
|
|
|
|
|
class EntityView(ViewTest):
|
|
|
|
|
|
|
|
|
def test_permission_denied(self):
|
|
|
"""
|
|
|
Tests if permission will be denied for client without sufficient privileges.
|
|
@@ -239,7 +239,7 @@ class EntityIptablesTest(ViewTest):
|
|
|
self.assertContains(response, ":INPUT")
|
|
|
self.assertContains(response, ":OUTPUT")
|
|
|
self.assertContains(response, ":FORWARD")
|
|
|
|
|
|
|
|
|
|
|
|
class ProjectIptablesTest(ViewTest):
|
|
|
|
|
@@ -275,10 +275,9 @@ class ProjectIptablesTest(ViewTest):
|
|
|
response = self.client.get(reverse("project_iptables", args=(200,)))
|
|
|
self.assertEqual(response.status_code, 404)
|
|
|
|
|
|
response = self.client.get(reverse("project_location_iptables", args=(200,1)))
|
|
|
response = self.client.get(reverse("project_location_iptables", args=(200, 1)))
|
|
|
self.assertEqual(response.status_code, 404)
|
|
|
|
|
|
|
|
|
def test_invalid_location(self):
|
|
|
"""
|
|
|
Tests if a 404 is returned if invalid location is specified.
|
|
@@ -286,7 +285,7 @@ class ProjectIptablesTest(ViewTest):
|
|
|
|
|
|
self.client.login(username="fullperms", password="fullperms")
|
|
|
|
|
|
response = self.client.get(reverse("project_location_iptables", args=(1,200)))
|
|
|
response = self.client.get(reverse("project_location_iptables", args=(1, 200)))
|
|
|
self.assertEqual(response.status_code, 404)
|
|
|
|
|
|
def test_content_type(self):
|
|
@@ -310,7 +309,7 @@ class ProjectIptablesTest(ViewTest):
|
|
|
response = self.client.get(reverse("project_iptables", args=(1,)))
|
|
|
self.assertEqual(response['Content-Disposition'], 'attachment; filename="test_project_1-iptables.zip"')
|
|
|
|
|
|
response = self.client.get(reverse("project_location_iptables", args=(1,1)))
|
|
|
response = self.client.get(reverse("project_location_iptables", args=(1, 1)))
|
|
|
self.assertEqual(response['Content-Disposition'], 'attachment; filename="test_project_1-test_location_1-iptables.zip"')
|
|
|
|
|
|
def test_project_entities_show(self):
|
|
@@ -328,7 +327,7 @@ class ProjectIptablesTest(ViewTest):
|
|
|
expected_zip_files = ["test_entity_1-iptables.conf",
|
|
|
"test_entity_2-iptables.conf",
|
|
|
"test_entity_3-iptables.conf",
|
|
|
"test_subnet-iptables.conf" ]
|
|
|
"test_subnet-iptables.conf"]
|
|
|
|
|
|
self.assertEqual(len(zipped_iptables.namelist()), 4)
|
|
|
self.assertEqual(zipped_iptables.namelist(), expected_zip_files)
|
|
@@ -348,7 +347,7 @@ class ProjectIptablesTest(ViewTest):
|
|
|
|
|
|
self.client.login(username="fullperms", password="fullperms")
|
|
|
|
|
|
response = self.client.get(reverse("project_location_iptables", args=(1,1)))
|
|
|
response = self.client.get(reverse("project_location_iptables", args=(1, 1)))
|
|
|
|
|
|
buff = StringIO(response.content)
|
|
|
|
|
@@ -366,4 +365,3 @@ class ProjectIptablesTest(ViewTest):
|
|
|
self.assertIn(":FORWARD", iptables_file)
|
|
|
|
|
|
zipped_iptables.close()
|
|
|
|