Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-django-webtest for 
openSUSE:Factory checked in at 2023-01-04 17:53:42
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-django-webtest (Old)
 and      /work/SRC/openSUSE:Factory/.python-django-webtest.new.1563 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-django-webtest"

Wed Jan  4 17:53:42 2023 rev:7 rq:1055864 version:1.9.10

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/python-django-webtest/python-django-webtest.changes  
    2021-12-27 16:07:35.213708535 +0100
+++ 
/work/SRC/openSUSE:Factory/.python-django-webtest.new.1563/python-django-webtest.changes
    2023-01-04 17:53:59.710674046 +0100
@@ -1,0 +2,8 @@
+Wed Jan  4 14:24:30 UTC 2023 - Dirk Müller <[email protected]>
+
+- update to 1.9.10:
+  * Add an optional WebTest backend that does not interfere with handling of
+    permissions by custom backends. Accessible via
+    WEBTEST_AUTHENTICATION_BACKEND setting.
+
+-------------------------------------------------------------------

Old:
----
  django-webtest-1.9.9.tar.gz

New:
----
  django-webtest-1.9.10.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-django-webtest.spec ++++++
--- /var/tmp/diff_new_pack.MSKU7L/_old  2023-01-04 17:54:00.378677983 +0100
+++ /var/tmp/diff_new_pack.MSKU7L/_new  2023-01-04 17:54:00.386678031 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package python-django-webtest
 #
-# Copyright (c) 2021 SUSE LLC
+# Copyright (c) 2023 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -18,7 +18,7 @@
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-django-webtest
-Version:        1.9.9
+Version:        1.9.10
 Release:        0
 Summary:        Django integration for WebTest
 License:        MIT

++++++ django-webtest-1.9.9.tar.gz -> django-webtest-1.9.10.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/django-webtest-1.9.9/CHANGES.rst 
new/django-webtest-1.9.10/CHANGES.rst
--- old/django-webtest-1.9.9/CHANGES.rst        2021-12-27 11:59:44.000000000 
+0100
+++ new/django-webtest-1.9.10/CHANGES.rst       2022-03-02 14:29:40.000000000 
+0100
@@ -2,6 +2,13 @@
 CHANGES
 =======
 
+1.9.10 (2022-03-02)
+-------------------
+
+- Add an optional WebTest backend that does not interfere with handling of 
permissions by
+  custom backends. Accessible via WEBTEST_AUTHENTICATION_BACKEND setting. 
Fixed #123
+
+
 1.9.9 (2021-12-27)
 ------------------
 
@@ -46,6 +53,7 @@
 
 - Add missing args to DjangoTestApp. Fixed #86
 
+
 1.9.4 (2018-10-27)
 ------------------
 
@@ -61,6 +69,7 @@
 
 - restore MIDDLEWARE_CLASSES support; fixed #84
 
+
 1.9.3 (2018-05-03)
 ------------------
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/django-webtest-1.9.9/PKG-INFO 
new/django-webtest-1.9.10/PKG-INFO
--- old/django-webtest-1.9.9/PKG-INFO   2021-12-27 11:59:44.482440700 +0100
+++ new/django-webtest-1.9.10/PKG-INFO  2022-03-02 14:29:40.400406000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: django-webtest
-Version: 1.9.9
+Version: 1.9.10
 Summary: Instant integration of Ian Bicking's WebTest 
(http://docs.pylonsproject.org/projects/webtest/) with Django's testing 
framework.
 Home-page: https://github.com/django-webtest/django-webtest
 Author: Mikhail Korobov
@@ -243,6 +243,13 @@
 CHANGES
 =======
 
+1.9.10 (2022-03-02)
+-------------------
+
+- Add an optional WebTest backend that does not interfere with handling of 
permissions by
+  custom backends. Accessible via WEBTEST_AUTHENTICATION_BACKEND setting. 
Fixed #123
+
+
 1.9.9 (2021-12-27)
 ------------------
 
@@ -287,6 +294,7 @@
 
 - Add missing args to DjangoTestApp. Fixed #86
 
+
 1.9.4 (2018-10-27)
 ------------------
 
@@ -302,6 +310,7 @@
 
 - restore MIDDLEWARE_CLASSES support; fixed #84
 
+
 1.9.3 (2018-05-03)
 ------------------
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/django-webtest-1.9.9/django_webtest/__init__.py 
new/django-webtest-1.9.10/django_webtest/__init__.py
--- old/django-webtest-1.9.9/django_webtest/__init__.py 2021-12-27 
11:59:44.000000000 +0100
+++ new/django-webtest-1.9.10/django_webtest/__init__.py        2022-03-02 
14:29:40.000000000 +0100
@@ -286,7 +286,9 @@
             self.settings_middleware.insert(index + 1, webtest_auth_middleware)
 
     def _setup_auth_backend(self):
-        backend_name = 'django_webtest.backends.WebtestUserBackend'
+        backend_name = getattr(
+            settings, 'WEBTEST_AUTHENTICATION_BACKEND',
+            'django_webtest.backends.WebtestUserBackend')
         settings.AUTHENTICATION_BACKENDS.insert(0, backend_name)
 
     def _setup_auth_class(self):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/django-webtest-1.9.9/django_webtest/backends.py 
new/django-webtest-1.9.10/django_webtest/backends.py
--- old/django-webtest-1.9.9/django_webtest/backends.py 2021-12-27 
11:59:44.000000000 +0100
+++ new/django-webtest-1.9.10/django_webtest/backends.py        2022-03-02 
14:29:40.000000000 +0100
@@ -23,3 +23,15 @@
 
     def clean_username(self, username):
         return from_wsgi_safe_string(username)
+
+
+class WebtestUserWithoutPermissionsBackend(WebtestUserBackend):
+    """
+    Auth backend that passes-through any permission check to further backends
+    """
+
+    def get_perm(self, user_obj, perm, obj=None):
+        # Indicate that this backend does not handle permissions and
+        # allow Django's django.contrib.auth.models._user_has_perm
+        # utility to move on to other enabled authentication backends.
+        return False
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/django-webtest-1.9.9/django_webtest.egg-info/PKG-INFO 
new/django-webtest-1.9.10/django_webtest.egg-info/PKG-INFO
--- old/django-webtest-1.9.9/django_webtest.egg-info/PKG-INFO   2021-12-27 
11:59:44.000000000 +0100
+++ new/django-webtest-1.9.10/django_webtest.egg-info/PKG-INFO  2022-03-02 
14:29:40.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: django-webtest
-Version: 1.9.9
+Version: 1.9.10
 Summary: Instant integration of Ian Bicking's WebTest 
(http://docs.pylonsproject.org/projects/webtest/) with Django's testing 
framework.
 Home-page: https://github.com/django-webtest/django-webtest
 Author: Mikhail Korobov
@@ -243,6 +243,13 @@
 CHANGES
 =======
 
+1.9.10 (2022-03-02)
+-------------------
+
+- Add an optional WebTest backend that does not interfere with handling of 
permissions by
+  custom backends. Accessible via WEBTEST_AUTHENTICATION_BACKEND setting. 
Fixed #123
+
+
 1.9.9 (2021-12-27)
 ------------------
 
@@ -287,6 +294,7 @@
 
 - Add missing args to DjangoTestApp. Fixed #86
 
+
 1.9.4 (2018-10-27)
 ------------------
 
@@ -302,6 +310,7 @@
 
 - restore MIDDLEWARE_CLASSES support; fixed #84
 
+
 1.9.3 (2018-05-03)
 ------------------
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/django-webtest-1.9.9/django_webtest_tests/testapp_tests/tests.py 
new/django-webtest-1.9.10/django_webtest_tests/testapp_tests/tests.py
--- old/django-webtest-1.9.9/django_webtest_tests/testapp_tests/tests.py        
2021-12-27 11:59:44.000000000 +0100
+++ new/django-webtest-1.9.10/django_webtest_tests/testapp_tests/tests.py       
2022-03-02 14:29:40.000000000 +0100
@@ -1,21 +1,22 @@
 # -*- coding: utf-8 -*-
-from __future__ import unicode_literals, absolute_import
-
+from __future__ import absolute_import, unicode_literals
 
 import django
 from django.contrib.auth.models import User
+
 try:
     from django.urls import reverse
 except ImportError:
     from django.core.urlresolvers import reverse
-from django.test.testcases import override_settings
-from unittest import skipIf
 
+from unittest import skipIf
+from unittest.mock import patch
 
+from django.test.testcases import override_settings
 from webtest import AppError, TestApp
 
 from django_webtest import WebTest
-from django_webtest.compat import is_authenticated, is_anonymous
+from django_webtest.compat import is_anonymous, is_authenticated
 
 
 class MethodsTest(WebTest):
@@ -265,7 +266,7 @@
 
                 # Middleware authentication check shouldn't crash
                 response = self.app.get('/template/index.html',
-                        user=custom_user)
+                                        user=custom_user)
                 user = response.context['user']
                 assert is_authenticated(user)
                 self.assertEqual(user, custom_user)
@@ -277,6 +278,34 @@
         self.app.get('/template/index.html', user=self.user)
 
 
+@override_settings(
+    WEBTEST_AUTHENTICATION_BACKEND=(
+        'django_webtest.backends.WebtestUserWithoutPermissionsBackend'),
+    AUTHENTICATION_BACKENDS=['testapp_tests.SimpleBackend'],
+)
+class CustomAuthTest(BaseAuthTest):
+
+    def test_backend_is_enabled(self):
+        from django.conf import settings
+
+        assert len(settings.AUTHENTICATION_BACKENDS) == 2
+        assert (
+            settings.AUTHENTICATION_BACKENDS[0]
+            == 'django_webtest.backends.WebtestUserWithoutPermissionsBackend'
+        )
+
+    def test_permission_passthrough(self):
+        from django.contrib.auth.backends import ModelBackend
+
+        class SimpleBackend(ModelBackend):
+            def has_perm(self, user_obj, perm, obj=None):
+                return perm == 'tests.allow'
+
+        with patch('testapp_tests.SimpleBackend', SimpleBackend, create=True):
+            assert self.user.has_perm('tests.allow') is True
+            assert self.user.has_perm('tests.deny') is False
+
+
 class GlobalAuthTest(BaseAuthTest):
 
     def test_set_user(self):
@@ -362,7 +391,6 @@
         self.assertEqual(page1_1.context['user'], self.user)
 
 
-
 class DjangoAssertsTest(BaseAuthTest):
 
     def test_assert_template_used(self):
@@ -407,7 +435,6 @@
         self.assertRedirects(page, reverse('protected'))
 
 
-
 class DisableAuthSetupTest(WebTest):
     setup_auth = False
 
@@ -430,7 +457,7 @@
 
         apps = list(settings.INSTALLED_APPS)
         apps.remove("django.contrib.sessions")
-        settings.INSTALLED_APPS= apps
+        settings.INSTALLED_APPS = apps
 
         response = self.app.get('/')
         self.assertEqual(response.status_int, 200)
@@ -453,6 +480,7 @@
             response['X-Unknown-Header']
         self.assertRaises(KeyError, access_bad_header)
 
+
 class TestCookies(WebTest):
     def test_cookies(self):
         self.app.set_cookie(str('test_cookie'), str('cookie monster!'))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/django-webtest-1.9.9/setup.py 
new/django-webtest-1.9.10/setup.py
--- old/django-webtest-1.9.9/setup.py   2021-12-27 11:59:44.000000000 +0100
+++ new/django-webtest-1.9.10/setup.py  2022-03-02 14:29:40.000000000 +0100
@@ -4,7 +4,7 @@
 from setuptools import setup
 
 
-version = '1.9.9'
+version = '1.9.10'
 
 
 def _read(name):

Reply via email to