|
@@ -191,22 +191,22 @@ class EntityViewTest(ViewTest):
|
|
|
|
|
|
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)>",]
|
|
|
"<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.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")
|
|
|
|
|
@@ -838,13 +838,13 @@ class EntityCreateViewTest(TestCase):
|
|
|
|
|
|
def test_initial_project(self):
|
|
|
"""
|
|
|
Tests if the choice field for project is defaulted to project passed as
|
|
|
part of GET parameters.
|
|
|
"""
|
|
|
|
|
|
|
|
|
view = EntityCreateView()
|
|
|
view.request = RequestFactory().get("/fake-path?project=1")
|
|
|
view.object = None
|
|
|
|
|
|
initial = view.get_initial()
|
|
|
|
|
@@ -852,13 +852,13 @@ class EntityCreateViewTest(TestCase):
|
|
|
|
|
|
def test_initial_location(self):
|
|
|
"""
|
|
|
Tests if the choice field for location is defaulted to location passed
|
|
|
as part of GET parameters.
|
|
|
"""
|
|
|
|
|
|
|
|
|
view = EntityCreateView()
|
|
|
view.request = RequestFactory().get("/fake-path?location=1")
|
|
|
view.object = None
|
|
|
|
|
|
initial = view.get_initial()
|
|
|
|
|
@@ -932,13 +932,13 @@ class EntityDeleteViewTest(TestCase):
|
|
|
def test_success_url(self):
|
|
|
"""
|
|
|
Validate that the success URL is set properly after delete.
|
|
|
"""
|
|
|
|
|
|
self.client.login(username="fullperms", password="fullperms")
|
|
|
|
|
|
|
|
|
response = self.client.get(reverse("entity_delete", args=(1,)))
|
|
|
|
|
|
response = self.client.post(reverse("entity_delete", args=(1,)),
|
|
|
{'csrfmiddlewaretoken': response.context['request'].META['CSRF_COOKIE']},
|
|
|
follow=True)
|
|
|
|
|
@@ -1053,13 +1053,13 @@ class InterfaceCreateViewTest(TestCase):
|
|
|
|
|
|
def test_initial_project(self):
|
|
|
"""
|
|
|
Tests if the choice field for entity is defaulted to entity passed as
|
|
|
part of GET parameters.
|
|
|
"""
|
|
|
|
|
|
|
|
|
view = InterfaceCreateView()
|
|
|
view.request = RequestFactory().get("/fake-path?entity=1")
|
|
|
view.object = None
|
|
|
|
|
|
initial = view.get_initial()
|
|
|
|
|
@@ -1141,13 +1141,13 @@ class InterfaceUpdateViewTest(TestCase):
|
|
|
Validate that the success URL is set properly after update.
|
|
|
"""
|
|
|
|
|
|
self.client.login(username="fullperms", password="fullperms")
|
|
|
|
|
|
interface = Interface.objects.get(pk=1)
|
|
|
|
|
|
|
|
|
response = self.client.get(reverse("interface_update", args=(1,)))
|
|
|
|
|
|
response = self.client.post(reverse("interface_update", args=(1,)),
|
|
|
{'csrfmiddlewaretoken': response.context['request'].META['CSRF_COOKIE'],
|
|
|
"name": interface.name,
|
|
|
"description": interface.name,
|
|
@@ -1226,13 +1226,13 @@ class InterfaceDeleteViewTest(TestCase):
|
|
|
def test_success_url(self):
|
|
|
"""
|
|
|
Validate that the success URL is set properly after delete.
|
|
|
"""
|
|
|
|
|
|
self.client.login(username="fullperms", password="fullperms")
|
|
|
|
|
|
|
|
|
response = self.client.get(reverse("interface_delete", args=(1,)))
|
|
|
|
|
|
response = self.client.post(reverse("interface_delete", args=(1,)),
|
|
|
{'csrfmiddlewaretoken': response.context['request'].META['CSRF_COOKIE']},
|
|
|
follow=True)
|
|
|
|