Changeset - 9b889983cd7b
[Not reviewed]
default
0 3 0
Branko Majic (branko) - 11 years ago 2013-07-27 10:57:18
branko@majic.rs
CONNT-15: Fixed some headline stuff. Added context tests for generated headlines.
3 files changed with 11 insertions and 8 deletions:
0 comments (0 inline, 0 general)
conntrackt/tests/test_views.py
Show inline comments
 
@@ -401,6 +401,7 @@ class ProjectUpdateViewTest(PermissionTe
 
        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):
 
@@ -427,6 +428,7 @@ class ProjectDeleteViewTest(PermissionTe
 
        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):
 
        """
 
@@ -475,6 +477,7 @@ class LocationUpdateViewTest(PermissionT
 
        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):
 
@@ -501,6 +504,7 @@ class LocationDeleteViewTest(PermissionT
 
        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):
 
        """
 
@@ -624,6 +628,7 @@ class EntityDeleteViewTest(PermissionTes
 
        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):
 
        """
 
@@ -686,6 +691,7 @@ class EntityUpdateViewTest(PermissionTes
 
        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):
 
@@ -782,6 +788,7 @@ class InterfaceUpdateViewTest(Permission
 
        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):
 
        """
 
@@ -854,6 +861,7 @@ class InterfaceDeleteViewTest(Permission
 
        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):
 
        """
 
@@ -1140,6 +1148,7 @@ class CommunicationUpdateViewTest(Permis
 
        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):
 
        """
 
@@ -1242,6 +1251,7 @@ class CommunicationDeleteViewTest(Permis
 
        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):
 
        """
conntrackt/urls.py
Show inline comments
 
@@ -33,7 +33,6 @@ urlpatterns = patterns(
 
    # View for deleting a location.
 
    url(r'^location/(?P<pk>\d+)/remove/$', LocationDeleteView.as_view(), name="location_delete"),
 

	
 

	
 
    # View for showing information about an entity.
 
    url(r'^entity/(?P<pk>\d+)/$', EntityView.as_view(),
 
        name='entity'),
 
@@ -64,6 +63,7 @@ urlpatterns = patterns(
 
    url(r'^project/(?P<project_id>\d+)/iptables/$', project_iptables, name="project_iptables"),
 
    # View for rendering zip file with iptables rules for all entities in a project for a specific location.
 
    url(r'^project/(?P<project_id>\d+)/location/(?P<location_id>\d+)/iptables/$', project_iptables, name="project_location_iptables"),
 

	
 
    # Views for logging-in/out the users.
 
    url(r'^login/$', login, {'template_name': 'conntrackt/login.html'}, name="login"),
 
    url(r'^logout/$', logout, name="logout"),
conntrackt/views.py
Show inline comments
 
@@ -778,13 +778,6 @@ class CommunicationCreateView(SetHeadlin
 

	
 
        return self.request.GET.get("next", reverse("project", args=(self.object.source.entity.project.pk,)))
 

	
 
    def get_headline(self):
 
        """
 
        Set headline based on interface name.
 
        """
 

	
 
        return "Delete interface %s" % self.object.name
 

	
 

	
 
class CommunicationUpdateView(SetHeadlineMixin, MultiplePermissionsRequiredMixin, UpdateView):
 
    """
0 comments (0 inline, 0 general)