File diff a52ea8fcddf2 → 9b889983cd7b
conntrackt/tests/test_views.py
Show inline comments
 
@@ -398,12 +398,13 @@ class ProjectUpdateViewTest(PermissionTe
 
        view = ProjectUpdateView.as_view()
 

	
 
        # Get the response.
 
        response = generate_get_response(view, None, pk=1)
 

	
 
        self.assertEqual(response.context_data["project"].name, "Test Project 1")
 
        self.assertEqual(response.context_data["headline"], "Update project Test Project 1")
 

	
 

	
 
class ProjectDeleteViewTest(PermissionTestMixin, TestCase):
 

	
 
    fixtures = ['test-data.json']
 

	
 
@@ -424,12 +425,13 @@ class ProjectDeleteViewTest(PermissionTe
 
        view = ProjectDeleteView.as_view()
 

	
 
        # Get the response.
 
        response = generate_get_response(view, None, pk=1)
 

	
 
        self.assertEqual(response.context_data["project"], project)
 
        self.assertEqual(response.context_data["headline"], "Delete project Test Project 1")
 

	
 
    def test_message(self):
 
        """
 
        Tests if the message gets added when the project is deleted.
 
        """
 

	
 
@@ -472,12 +474,13 @@ class LocationUpdateViewTest(PermissionT
 
        view = LocationUpdateView.as_view()
 

	
 
        # Get the response.
 
        response = generate_get_response(view, None, pk=1)
 

	
 
        self.assertEqual(response.context_data["location"].name, "Test Location 1")
 
        self.assertEqual(response.context_data["headline"], "Update location Test Location 1")
 

	
 

	
 
class LocationDeleteViewTest(PermissionTestMixin, TestCase):
 

	
 
    fixtures = ['test-data.json']
 

	
 
@@ -498,12 +501,13 @@ class LocationDeleteViewTest(PermissionT
 
        view = LocationDeleteView.as_view()
 

	
 
        # Get the response.
 
        response = generate_get_response(view, None, pk=1)
 

	
 
        self.assertEqual(response.context_data["location"], location)
 
        self.assertEqual(response.context_data["headline"], "Delete location Test Location 1")
 

	
 
    def test_message(self):
 
        """
 
        Tests if the message gets added when the location is deleted.
 
        """
 

	
 
@@ -621,12 +625,13 @@ class EntityDeleteViewTest(PermissionTes
 
        view = EntityDeleteView.as_view()
 

	
 
        # Get the response.
 
        response = generate_get_response(view, None, pk=1)
 

	
 
        self.assertEqual(response.context_data["entity"], entity)
 
        self.assertEqual(response.context_data["headline"], "Delete entity Test Entity 1")
 

	
 
    def test_message(self):
 
        """
 
        Tests if the message gets added when the entity is deleted.
 
        """
 

	
 
@@ -683,12 +688,13 @@ class EntityUpdateViewTest(PermissionTes
 
        view = EntityUpdateView.as_view()
 

	
 
        # Get the response.
 
        response = generate_get_response(view, None, pk=1)
 

	
 
        self.assertEqual(response.context_data["entity"].name, "Test Entity 1")
 
        self.assertEqual(response.context_data["headline"], "Update entity Test Entity 1")
 

	
 

	
 
class InterfaceCreateViewTest(PermissionTestMixin, TestCase):
 

	
 
    view_class = InterfaceCreateView
 
    sufficient_permissions = ("add_interface",)
 
@@ -779,12 +785,13 @@ class InterfaceUpdateViewTest(Permission
 
        response = generate_get_response(view, None, pk=1)
 

	
 
        # Set-up expected interface.
 
        interface = Interface.objects.get(pk=1)
 

	
 
        self.assertEqual(response.context_data["interface"], interface)
 
        self.assertEqual(response.context_data["headline"], "Update interface eth0")
 

	
 
    def test_form_entity_limit(self):
 
        """
 
        Tests if the queryset is properly limitted to specific project's
 
        entities.
 
        """
 
@@ -851,12 +858,13 @@ class InterfaceDeleteViewTest(Permission
 
        view = InterfaceDeleteView.as_view()
 

	
 
        # Get the response.
 
        response = generate_get_response(view, None, pk=1)
 

	
 
        self.assertEqual(response.context_data["interface"], interface)
 
        self.assertEqual(response.context_data["headline"], "Delete interface eth0")
 

	
 
    def test_message(self):
 
        """
 
        Tests if the message gets added when the interface is deleted.
 
        """
 

	
 
@@ -1137,12 +1145,13 @@ class CommunicationUpdateViewTest(Permis
 
        response = generate_get_response(view, None, pk=1)
 

	
 
        # Set-up expected interface.
 
        communication = Communication.objects.get(pk=1)
 

	
 
        self.assertEqual(response.context_data["communication"], communication)
 
        self.assertEqual(response.context_data["headline"], "Update communication Test Entity 2 -> Test Entity 1 (TCP:22)")
 

	
 
    def test_form_interface_limit(self):
 
        """
 
        Tests if the queryset is properly limitted to specific project's
 
        entity interfaces.
 
        """
 
@@ -1239,12 +1248,13 @@ class CommunicationDeleteViewTest(Permis
 
        view = CommunicationDeleteView.as_view()
 

	
 
        # Get the response.
 
        response = generate_get_response(view, None, pk=1)
 

	
 
        self.assertEqual(response.context_data["communication"], communication)
 
        self.assertEqual(response.context_data["headline"], "Delete communication Test Entity 2 -> Test Entity 1 (TCP:22)")
 

	
 
    def test_message(self):
 
        """
 
        Tests if the message gets added when the communication is deleted.
 
        """