Changeset - ba26a581c827
[Not reviewed]
default
0 8 0
Branko Majic (branko) - 6 years ago 2017-12-21 12:25:33
branko@majic.rs
CONNT-25: Updating appliction and project to use Django 1.6.x:

- Fixed tests to denote that ordering is not important in a number of
queryset tests.
- Replaced deprecated parameter name mimetype with content_type in views.
- Updated development requirements and setup script to depend on Django 1.6.x.
- Removed requirement for django-discover-runner, which is now incorporated
into Django itself and works out of the box.
- Updated development requirements to include pytz (needed for USE_TZ = True
setting).
8 files changed with 25 insertions and 32 deletions:
0 comments (0 inline, 0 general)
conntrackt/tests/test_views.py
Show inline comments
 
@@ -164,7 +164,7 @@ class ProjectViewTest(RenderTestMixin, P
 

	
 
        # Validate context data.
 
        self.assertEqual(location.name, "Test Location 1")
 
        self.assertQuerysetEqual(entities, expected_entities)
 
        self.assertQuerysetEqual(entities, expected_entities, ordered=False)
 

	
 
        # Fetch context data from response.
 
        location, entities = response.context_data["location_entities"][1]
 
@@ -175,7 +175,7 @@ class ProjectViewTest(RenderTestMixin, P
 

	
 
        # Validate context data.
 
        self.assertEqual(location.name, "Test Location 2")
 
        self.assertQuerysetEqual(entities, expected_entities)
 
        self.assertQuerysetEqual(entities, expected_entities, ordered=False)
 

	
 
        # Validate context data.
 
        self.assertEqual(str(response.context_data["project"]), "Test Project 1")
 
@@ -911,7 +911,7 @@ class InterfaceUpdateViewTest(RenderTest
 
                             "<Entity: Test Entity 3 (Test Project 1 - Test Location 2)>",
 
                             "<Entity: Test Subnet 4 (Test Project 1 - Test Location 2)>"]
 

	
 
        self.assertQuerysetEqual(form.fields["entity"].queryset, expected_entities)
 
        self.assertQuerysetEqual(form.fields["entity"].queryset, expected_entities, ordered=False)
 

	
 
    def test_success_url(self):
 
        """
 
@@ -1049,8 +1049,8 @@ class CommunicationCreateViewTest(Render
 
        expected_interfaces = ["<Interface: Test Entity 1 (192.168.1.1)>",
 
                               "<Interface: Test Entity 2 (192.168.1.2)>"]
 

	
 
        self.assertQuerysetEqual(form.fields["source"].queryset, expected_interfaces)
 
        self.assertQuerysetEqual(form.fields["destination"].queryset, expected_interfaces)
 
        self.assertQuerysetEqual(form.fields["source"].queryset, expected_interfaces, ordered = False)
 
        self.assertQuerysetEqual(form.fields["destination"].queryset, expected_interfaces, ordered = False)
 

	
 
    def test_interface_limit_to_entity(self):
 
        """
 
@@ -1069,8 +1069,8 @@ class CommunicationCreateViewTest(Render
 
        expected_interfaces = ["<Interface: Test Entity 1 (192.168.1.1)>",
 
                               "<Interface: Test Entity 2 (192.168.1.2)>"]
 

	
 
        self.assertQuerysetEqual(form.fields["source"].queryset, expected_interfaces)
 
        self.assertQuerysetEqual(form.fields["destination"].queryset, expected_interfaces)
 
        self.assertQuerysetEqual(form.fields["source"].queryset, expected_interfaces, ordered=False)
 
        self.assertQuerysetEqual(form.fields["destination"].queryset, expected_interfaces, ordered=False)
 

	
 
    def test_interface_limit_project(self):
 
        """
 
@@ -1089,8 +1089,8 @@ class CommunicationCreateViewTest(Render
 
        expected_interfaces = ["<Interface: Test Entity 1 (192.168.1.1)>",
 
                               "<Interface: Test Entity 2 (192.168.1.2)>"]
 

	
 
        self.assertQuerysetEqual(form.fields["source"].queryset, expected_interfaces)
 
        self.assertQuerysetEqual(form.fields["destination"].queryset, expected_interfaces)
 
        self.assertQuerysetEqual(form.fields["source"].queryset, expected_interfaces, ordered=False)
 
        self.assertQuerysetEqual(form.fields["destination"].queryset, expected_interfaces, ordered=False)
 

	
 
    def test_initial_from_entity(self):
 
        """
 
@@ -1283,8 +1283,8 @@ class CommunicationUpdateViewTest(Render
 
                               "<Interface: Test Entity 3 (192.168.1.3)>",
 
                               "<Interface: Test Subnet 4 (10.10.4.0/255.255.255.0)>"]
 

	
 
        self.assertQuerysetEqual(form.fields["source"].queryset, expected_interfaces)
 
        self.assertQuerysetEqual(form.fields["destination"].queryset, expected_interfaces)
 
        self.assertQuerysetEqual(form.fields["source"].queryset, expected_interfaces, ordered=False)
 
        self.assertQuerysetEqual(form.fields["destination"].queryset, expected_interfaces, ordered=False)
 

	
 
    def test_success_url_next(self):
 
        """
conntrackt/views.py
Show inline comments
 
@@ -256,7 +256,7 @@ def entity_iptables(request, pk):
 
    # content.
 
    entity = get_object_or_404(Entity, pk=pk)
 
    content = generate_entity_iptables(entity)
 
    response = HttpResponse(content, mimetype='text/plain')
 
    response = HttpResponse(content, content_type='text/plain')
 

	
 
    # Add the Content-Disposition information for the browser, telling the
 
    # browser to download the file with suggested filename.
 
@@ -299,7 +299,7 @@ def project_iptables(request, project_id
 

	
 
    # Create the response object, setting the mime type so browser could offer
 
    # to open the file with program as well.
 
    response = HttpResponse(mimetype='application/zip')
 
    response = HttpResponse(content_type='application/zip')
 

	
 
    # If specific location was specified, get the entities that are part of that
 
    # project location only, otherwise fetch all of the project's entities. Also
 
@@ -1005,7 +1005,7 @@ def project_diagram(request, pk):
 
    content = generate_project_diagram(project).create_svg()
 

	
 
    # Set the mime type.
 
    response = HttpResponse(content, mimetype='image/svg+xml')
 
    response = HttpResponse(content, content_type='image/svg+xml')
 

	
 
    # Return the response object.
 
    return response
 
@@ -1129,7 +1129,7 @@ class APISearchView(MultiplePermissionsR
 

	
 
        # Generate the JSON response.
 
        content = json.dumps(items)
 
        response = HttpResponse(content, mimetype="application/json")
 
        response = HttpResponse(content, content_type="application/json")
 

	
 
        # Return the response.
 
        return response
requirements/base.in
Show inline comments
 
@@ -24,7 +24,7 @@ django-braces~=1.12.0
 
django-crispy-forms~=1.6.0
 

	
 
# Web framework used by application.
 
django~=1.5.0
 
django~=1.6.0
 

	
 
# Library for programatic calculation of colours (contrasts,
 
# inversions etc).
requirements/development.in
Show inline comments
 
@@ -22,9 +22,6 @@
 
# Used for generating test code coverage report.
 
coverage~=4.4.0
 

	
 
# Convenience test runner tailored for running Django tests.
 
django-discover-runner~=0.3.0
 

	
 
# Used for dynamic generation of fixture data in tests.
 
factory_boy~=2.1.0
 

	
 
@@ -32,4 +29,7 @@ factory_boy~=2.1.0
 
mock~=1.3.0
 

	
 
# Used for building documentation.
 
sphinx~=1.6.0
 
\ No newline at end of file
 
sphinx~=1.6.0
 

	
 
# Used for handling of timezones.
 
pytz
 
\ No newline at end of file
requirements/development.txt
Show inline comments
 
@@ -11,8 +11,7 @@ chardet==3.0.4            # via requests
 
coverage==4.4.2
 
django-braces==1.12.0
 
django-crispy-forms==1.6.1
 
django-discover-runner==0.3
 
django==1.5.12
 
django==1.6.11
 
docutils==0.14            # via sphinx
 
factory-boy==2.1.2
 
funcsigs==1.0.2           # via mock
 
@@ -26,7 +25,7 @@ pbr==3.1.1                # via mock
 
pydot==1.2.3
 
pygments==2.2.0           # via sphinx
 
pyparsing==2.2.0          # via pydot
 
pytz==2017.3              # via babel
 
pytz==2017.3
 
requests==2.18.4          # via sphinx
 
six==1.11.0               # via mock, sphinx
 
snowballstemmer==1.2.1    # via sphinx
requirements/test.txt
Show inline comments
 
@@ -11,8 +11,7 @@ chardet==3.0.4            # via requests
 
coverage==4.4.2
 
django-braces==1.12.0
 
django-crispy-forms==1.6.1
 
django-discover-runner==0.3
 
django==1.5.12
 
django==1.6.11
 
docutils==0.14            # via sphinx
 
factory-boy==2.1.2
 
funcsigs==1.0.2           # via mock
 
@@ -26,7 +25,7 @@ pbr==3.1.1                # via mock
 
pydot==1.2.3
 
pygments==2.2.0           # via sphinx
 
pyparsing==2.2.0          # via pydot
 
pytz==2017.3              # via babel
 
pytz==2017.3
 
requests==2.18.4          # via sphinx
 
six==1.11.0               # via mock, sphinx
 
snowballstemmer==1.2.1    # via sphinx
setup.py
Show inline comments
 
@@ -26,7 +26,7 @@ README = open(os.path.join(os.path.dirna
 
INSTALL_REQUIREMENTS = [
 
    "django-braces~=1.12.0",
 
    "django-crispy-forms~=1.6.0",
 
    "django~=1.5.0",
 
    "django~=1.6.0",
 
    "palette~=0.2.0",
 
    "pydot~=1.2.0",
 
    "south~=1.0.0",
testproject/testproject/settings.py
Show inline comments
 
@@ -152,8 +152,6 @@ INSTALLED_APPS = (
 
    'south',
 
    # Generic mixins for Django.
 
    'braces',
 
    # Enable test-runner.
 
    'discover_runner',
 
    # Better forms, including styling functions.
 
    'crispy_forms',
 
)
 
@@ -189,6 +187,3 @@ LOGGING = {
 

	
 
# View that should be called for log-in action.
 
LOGIN_URL = "login"
 

	
 
# Use custom test runner.
 
TEST_RUNNER = 'discover_runner.DiscoverRunner'
0 comments (0 inline, 0 general)