Changeset - c966cf604d1c
[Not reviewed]
default
0 1 0
Branko Majic (branko) - 8 years ago 2017-12-19 14:52:39
branko@majic.rs
CONNT-28: Updated ordering of elements in one of the tests for expected results to avoid test failure.
1 file changed with 2 insertions and 2 deletions:
0 comments (0 inline, 0 general)
conntrackt/tests/test_views.py
Show inline comments
 
@@ -194,50 +194,50 @@ class EntityViewTest(PermissionTestMixin
 
        Set-up some test data.
 
        """
 

	
 
        setup_test_data()
 

	
 
    def test_context(self):
 
        """
 
        Tests if the form comes pre-populated with proper content.
 
        """
 

	
 
        # Get the view.
 
        view = EntityView.as_view()
 

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

	
 
        # Set-up expected context data.
 
        expected_entity = Entity.objects.get(pk=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 4 -> 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_outgoing_communications = ["<Communication: Test Entity 1 -> Test Entity 3 (UDP:53)>",
 
                                            "<Communication: Test Entity 1 -> Test Entity 2 (UDP:123)>"]
 

	
 
        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)
 

	
 

	
 
class EntityIptablesTest(PermissionTestMixin, TestCase):
 

	
 
    view_function = staticmethod(entity_iptables)
 
    sufficient_permissions = ("view",)
 
    permission_test_view_kwargs = {"pk": "1"}
 

	
 
    def setUp(self):
 
        """
 
        Set-up some test data.
 
        """
 

	
 
        setup_test_data()
 

	
0 comments (0 inline, 0 general)