# HG changeset patch # User Branko Majic # Date 2017-12-21 12:25:33 # Node ID ba26a581c827c8581599421c39f9ffac6edf67f9 # Parent 1291c9123c4569c4655d53082287dd0b08426277 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). diff --git a/conntrackt/tests/test_views.py b/conntrackt/tests/test_views.py --- a/conntrackt/tests/test_views.py +++ b/conntrackt/tests/test_views.py @@ -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 "", ""] - 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 = ["", ""] - 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 = ["", ""] - 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 = ["", ""] - 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 "", ""] - 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): """ diff --git a/conntrackt/views.py b/conntrackt/views.py --- a/conntrackt/views.py +++ b/conntrackt/views.py @@ -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 diff --git a/requirements/base.in b/requirements/base.in --- a/requirements/base.in +++ b/requirements/base.in @@ -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). diff --git a/requirements/development.in b/requirements/development.in --- a/requirements/development.in +++ b/requirements/development.in @@ -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 diff --git a/requirements/development.txt b/requirements/development.txt --- a/requirements/development.txt +++ b/requirements/development.txt @@ -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 diff --git a/requirements/test.txt b/requirements/test.txt --- a/requirements/test.txt +++ b/requirements/test.txt @@ -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 diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -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", diff --git a/testproject/testproject/settings.py b/testproject/testproject/settings.py --- a/testproject/testproject/settings.py +++ b/testproject/testproject/settings.py @@ -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'