- 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
This commit is contained in:
Steve Kowalik 2022-02-23 05:28:36 +00:00 committed by Git OBS Bridge
parent cb0398a9ab
commit 823373c29d
6 changed files with 169 additions and 34 deletions

View File

@ -1,24 +0,0 @@
From 973325c14324c00d47f7c128f1c5c5e1233f3d59 Mon Sep 17 00:00:00 2001
From: maurepass <maurepass@gmail.com>
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):

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2a8cc076fb0c9c37f775f5419d554737138e0b435f69a90d872089de60d5bc00
size 26345

3
djet-0.3.0.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:44e59b880fccd36a34d9eae1ac150129ad3bf339f953e32a47e1cda3dc412819
size 34390

View File

@ -1,3 +1,13 @@
-------------------------------------------------------------------
Wed Feb 23 05:26:26 UTC 2022 - Steve Kowalik <steven.kowalik@suse.com>
- 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 <tchvatal@suse.com>

View File

@ -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

View File

@ -0,0 +1,149 @@
From f97c37afeb1b6f17055d2eebadaa42bc316cd15f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kamil=20Ga=C5=82uszka?= <kamil.galuszka@solution4future.com>
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):