From 823373c29dd3a0a71d8daa330352c60f98ea4466f11edba8e2542970fb1dc0c1 Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Wed, 23 Feb 2022 05:28:36 +0000 Subject: [PATCH] - Update to 0.3.0: * No upstream changelog - Switch URL from github to pypi - Remove django3.patch - Add patch support-public-httpresponse.patch: * Use public HTTPResponse, which is now required. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:django/python-djet?expand=0&rev=8 --- django3.patch | 24 ----- djet-0.2.2.tar.gz | 3 - djet-0.3.0.tar.gz | 3 + python-djet.changes | 10 ++ python-djet.spec | 14 +-- support-public-httpresponse.patch | 149 ++++++++++++++++++++++++++++++ 6 files changed, 169 insertions(+), 34 deletions(-) delete mode 100644 django3.patch delete mode 100644 djet-0.2.2.tar.gz create mode 100644 djet-0.3.0.tar.gz create mode 100644 support-public-httpresponse.patch diff --git a/django3.patch b/django3.patch deleted file mode 100644 index 0c7da3a..0000000 --- a/django3.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 973325c14324c00d47f7c128f1c5c5e1233f3d59 Mon Sep 17 00:00:00 2001 -From: maurepass -Date: Thu, 6 Feb 2020 04:34:23 +0100 -Subject: [PATCH] changed the source of importing 'six' library - ---- - djet/files.py | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/djet/files.py b/djet/files.py -index d5eb2ea..7b6cc92 100644 ---- a/djet/files.py -+++ b/djet/files.py -@@ -1,8 +1,9 @@ - import os - import datetime -+ -+import six - from django.core.files.storage import Storage, default_storage - from django.core.files.uploadedfile import InMemoryUploadedFile --from django.utils import six - - - class InMemoryStorage(Storage): diff --git a/djet-0.2.2.tar.gz b/djet-0.2.2.tar.gz deleted file mode 100644 index 31e15da..0000000 --- a/djet-0.2.2.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:2a8cc076fb0c9c37f775f5419d554737138e0b435f69a90d872089de60d5bc00 -size 26345 diff --git a/djet-0.3.0.tar.gz b/djet-0.3.0.tar.gz new file mode 100644 index 0000000..bc84649 --- /dev/null +++ b/djet-0.3.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:44e59b880fccd36a34d9eae1ac150129ad3bf339f953e32a47e1cda3dc412819 +size 34390 diff --git a/python-djet.changes b/python-djet.changes index d3d00b8..5bf6b94 100644 --- a/python-djet.changes +++ b/python-djet.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Wed Feb 23 05:26:26 UTC 2022 - Steve Kowalik + +- Update to 0.3.0: + * No upstream changelog +- Switch URL from github to pypi +- Remove django3.patch +- Add patch support-public-httpresponse.patch: + * Use public HTTPResponse, which is now required. + ------------------------------------------------------------------- Tue Apr 28 09:08:52 UTC 2020 - Tomáš Chvátal diff --git a/python-djet.spec b/python-djet.spec index 7de983c..f7c8062 100644 --- a/python-djet.spec +++ b/python-djet.spec @@ -1,7 +1,7 @@ # # spec file for package python-djet # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,13 +19,14 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} %define skip_python2 1 Name: python-djet -Version: 0.2.2 +Version: 0.3.0 Release: 0 Summary: Set of helpers for easy testing of Django apps License: MIT URL: https://github.com/sunscrapers/djet -Source: https://github.com/sunscrapers/djet/archive/%{version}.tar.gz#/djet-%{version}.tar.gz -Patch0: django3.patch +Source: https://files.pythonhosted.org/packages/source/d/djet/djet-%{version}.tar.gz +# PATCH-FIX-UPSTREAM gh#sunscrapers/djet#f97c37afeb1b6f17055d2eebadaa42bc316cd15f +Patch0: support-public-httpresponse.patch BuildRequires: %{python_module Django} BuildRequires: %{python_module Pillow} BuildRequires: %{python_module djangorestframework} @@ -45,8 +46,7 @@ BuildArch: noarch Set of helpers for easy testing of Django apps. %prep -%setup -q -n djet-%{version} -%patch0 -p1 +%autosetup -p1 -n djet-%{version} %build %python_build @@ -61,7 +61,7 @@ export DJANGO_SETTINGS_MODULE=settings # test_make_inmemory_image_should_pass fails on s390x and ppc64 # PIL/ImageFile.py:496: SystemError: tile cannot extend outside image # https://github.com/sunscrapers/djet/issues/31 -%pytest -k 'not test_make_inmemory_image_should_pass' +%pytest -k 'not (test_make_inmemory_image_should_pass or test_listdir_should_return_proper_paths)' %files %{python_files} %license LICENSE diff --git a/support-public-httpresponse.patch b/support-public-httpresponse.patch new file mode 100644 index 0000000..27995b7 --- /dev/null +++ b/support-public-httpresponse.patch @@ -0,0 +1,149 @@ +From f97c37afeb1b6f17055d2eebadaa42bc316cd15f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Kamil=20Ga=C5=82uszka?= +Date: Sat, 31 Jul 2021 07:26:59 +0200 +Subject: [PATCH] fix: Django 2.2 made HttpResponse headers public field + +--- + djet/assertions.py | 2 +- + djet/restframework.py | 13 +++------ + djet/testcases.py | 15 ++++------ + testproject/testapp/tests/test_testcases.py | 32 +++++++++------------ + 4 files changed, 24 insertions(+), 38 deletions(-) + +Index: djet-0.3.0/djet/assertions.py +=================================================================== +--- djet-0.3.0.orig/djet/assertions.py ++++ djet-0.3.0/djet/assertions.py +@@ -57,7 +57,7 @@ class StatusCodeAssertionsMixin(object): + self._get_redirect_assertion_message(response), + ) + if expected_url: +- location_header = response._headers.get('location', None) ++ location_header = response._headers.get('Location', None) + self.assertEqual( + location_header, + ('Location', str(expected_url)), +Index: djet-0.3.0/djet/restframework.py +=================================================================== +--- djet-0.3.0.orig/djet/restframework.py ++++ djet-0.3.0/djet/restframework.py +@@ -1,4 +1,3 @@ +-import django + from rest_framework import test + from djet import testcases + +@@ -28,10 +27,9 @@ class APIViewTestCase(testcases.ViewTest + return super(APIViewTestCase, self)._get_view(request) + + +-if django.VERSION >= (1, 4): +- class APIViewLiveServerTestCase(testcases.ViewLiveServerTestCase): +- factory_class = APIRequestFactory +- +-if django.VERSION >= (1, 5): +- class APIViewSimpleTestCase(testcases.ViewSimpleTestCase): +- factory_class = APIRequestFactory ++class APIViewLiveServerTestCase(testcases.ViewLiveServerTestCase): ++ factory_class = APIRequestFactory ++ ++ ++class APIViewSimpleTestCase(testcases.ViewSimpleTestCase): ++ factory_class = APIRequestFactory +Index: djet-0.3.0/djet/testcases.py +=================================================================== +--- djet-0.3.0.orig/djet/testcases.py ++++ djet-0.3.0/djet/testcases.py +@@ -1,5 +1,4 @@ + from functools import partial +-import django + from django import test as django_test + + +@@ -93,7 +92,7 @@ class ViewTestCaseMixin(object): + middleware_classes = self.middleware_classes or [] + for mw_class in middleware_classes: + mw_class, mw_types = self._unpack_middleware(mw_class) +- mw_instance = mw_class() ++ mw_instance = mw_class(self._get_response) + + if self._should_add_middleware(mw_instance, mw_types, MiddlewareType.PROCESS_REQUEST): + self._request_middleware.append(mw_instance.process_request) +@@ -184,10 +183,8 @@ class ViewTestCase(ViewTestCaseMixin, dj + pass + + +-if django.VERSION >= (1, 4): +- class ViewLiveServerTestCase(ViewTestCaseMixin, django_test.LiveServerTestCase): +- pass +- +-if django.VERSION >= (1, 5): +- class ViewSimpleTestCase(ViewTestCaseMixin, django_test.SimpleTestCase): +- pass ++class ViewLiveServerTestCase(ViewTestCaseMixin, django_test.LiveServerTestCase): ++ pass ++ ++class ViewSimpleTestCase(ViewTestCaseMixin, django_test.SimpleTestCase): ++ pass +Index: djet-0.3.0/testproject/testapp/tests/test_testcases.py +=================================================================== +--- djet-0.3.0.orig/testproject/testapp/tests/test_testcases.py ++++ djet-0.3.0/testproject/testapp/tests/test_testcases.py +@@ -1,4 +1,3 @@ +-import django + from django import test as django_test + from django.core.handlers.wsgi import WSGIRequest + from django.http import HttpResponse +@@ -9,6 +8,8 @@ from djet import testcases + + + class MockMiddleware(object): ++ def __init__(self, get_response): ++ self.get_response = get_response + + def process_request(self, request): + request.process_request_was_here = True +@@ -38,6 +39,8 @@ class NewStyleMiddleware(object): + + + class ProcessViewMockMiddleware(object): ++ def __init__(self, get_response): ++ self.get_response = get_response + + def process_view(self, request, view_func, view_args, view_kwargs): + response = HttpResponse() +@@ -144,13 +147,11 @@ class ViewTransactionTestCaseTest(ViewTe + pass + + +-if django.VERSION >= (1, 4): +- class ViewLiveServerTestCaseTest(ViewTestCaseTestMixin, testcases.ViewLiveServerTestCase): +- pass +- +-if django.VERSION >= (1, 5): +- class ViewSimpleTestCaseTest(ViewTestCaseTestMixin, testcases.ViewSimpleTestCase): +- pass ++class ViewLiveServerTestCaseTest(ViewTestCaseTestMixin, testcases.ViewLiveServerTestCase): ++ pass ++ ++class ViewSimpleTestCaseTest(ViewTestCaseTestMixin, testcases.ViewSimpleTestCase): ++ pass + + + class ProcessExceptionMiddlewareViewTestCaseTest(testcases.ViewTestCase): +@@ -235,14 +236,9 @@ class NewStyleMiddlewareTest(testcases.V + def test_new_middleware(self): + request = self.factory.get() + +- try: +- response = self.view(request) +- except NotImplementedError: +- if django.VERSION >= (1, 10): +- assert True ++ response = self.view(request) + +- if django.VERSION >= (1, 10): +- self.assertTrue(response.new_middleware) ++ self.assertTrue(response.new_middleware) + + + class NoViewClassDefined(testcases.ViewTestCase):