Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-redis for openSUSE:Factory 
checked in at 2021-07-18 23:44:49
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-redis (Old)
 and      /work/SRC/openSUSE:Factory/.python-redis.new.2632 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-redis"

Sun Jul 18 23:44:49 2021 rev:30 rq:906638 version:3.5.3

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-redis/python-redis.changes        
2021-03-11 20:08:41.088312376 +0100
+++ /work/SRC/openSUSE:Factory/.python-redis.new.2632/python-redis.changes      
2021-07-18 23:44:52.599079525 +0200
@@ -1,0 +2,7 @@
+Fri Jul 16 09:15:51 UTC 2021 - Matej Cepl <mc...@suse.com>
+
+- Add account-defaults-redis.patch which fixes failing tests by
+  taking into consideration redis defaults, not overwriting them
+  (gh#andymccurdy/redis-py#1499).
+
+-------------------------------------------------------------------

New:
----
  account-defaults-redis.patch

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

Other differences:
------------------
++++++ python-redis.spec ++++++
--- /var/tmp/diff_new_pack.KVvA2h/_old  2021-07-18 23:44:52.999076449 +0200
+++ /var/tmp/diff_new_pack.KVvA2h/_new  2021-07-18 23:44:52.999076449 +0200
@@ -25,6 +25,9 @@
 Group:          Development/Languages/Python
 URL:            https://github.com/andymccurdy/redis-py
 Source:         
https://files.pythonhosted.org/packages/source/r/redis/redis-%{version}.tar.gz
+# PATCH-FIX-UPSTREAM account-defaults-redis.patch gh#andymccurdy/redis-py#1499 
mc...@suse.com
+# changing unit tests to account for defaults in redis
+Patch0:         account-defaults-redis.patch
 BuildRequires:  %{python_module mock}
 BuildRequires:  %{python_module pytest >= 2.7.0}
 BuildRequires:  %{python_module setuptools}
@@ -41,7 +44,7 @@
 The Python interface to the Redis key-value store.
 
 %prep
-%setup -q -n redis-%{version}
+%autosetup -p1 -n redis-%{version}
 
 %build
 %python_build
@@ -52,8 +55,7 @@
 
 %check
 %{_sbindir}/redis-server --port 6379 &
-# Skipped tests because of gh#andymccurdy/redis-py#1459
-%pytest -k 'not (test_acl_getuser_setuser or test_acl_list)'
+%pytest
 
 killall redis-server
 

++++++ account-defaults-redis.patch ++++++
>From fea5d60c4426ec31a0e309a2efb2be62f6b2a412 Mon Sep 17 00:00:00 2001
From: "Chayim I. Kirshen" <c...@kirshen.com>
Date: Mon, 28 Jun 2021 16:34:00 +0300
Subject: [PATCH 1/3] changing unit tests to account for defaults in redis
 flags

Some versions of redis (validated against 6.2.4) set extra flags, making the 
tests fail.

Modified the tests to validate the specific flags pertaining to the test case 
are in place.

Similarly with acl_list, as other tests validate the specifics of acl_setuser, 
I changed it to validate against the acl list.

Finally, while here, I added python 3.9 to tox
---
 tests/test_commands.py |   37 ++++++++++++++++++-------------------
 1 file changed, 18 insertions(+), 19 deletions(-)

--- a/tests/test_commands.py
+++ b/tests/test_commands.py
@@ -105,25 +105,24 @@ class TestRedisCommands(object):
 
         # test enabled=False
         assert r.acl_setuser(username, enabled=False, reset=True)
-        assert r.acl_getuser(username) == {
-            'categories': ['-@all'],
-            'commands': [],
-            'enabled': False,
-            'flags': ['off'],
-            'keys': [],
-            'passwords': [],
-        }
+        acl = r.acl_getuser(username)
+        assert acl['categories'] == ['-@all']
+        assert acl['commands'] == []
+        assert acl['keys'] == []
+        assert acl['passwords'] == []
+        assert 'off' in acl['flags']
+        assert acl['enabled'] is False
 
         # test nopass=True
         assert r.acl_setuser(username, enabled=True, reset=True, nopass=True)
-        assert r.acl_getuser(username) == {
-            'categories': ['-@all'],
-            'commands': [],
-            'enabled': True,
-            'flags': ['on', 'nopass'],
-            'keys': [],
-            'passwords': [],
-        }
+        acl = r.acl_getuser(username)
+        assert acl['categories'] == ['-@all']
+        assert acl['commands'] == []
+        assert acl['keys'] == []
+        assert acl['passwords'] == []
+        assert 'on' in acl['flags']
+        assert 'nopass' in acl['flags']
+        assert acl['enabled'] is True
 
         # test all args
         assert r.acl_setuser(username, enabled=True, reset=True,
@@ -135,7 +134,7 @@ class TestRedisCommands(object):
         assert set(acl['categories']) == set(['-@all', '+@set', '+@hash'])
         assert set(acl['commands']) == set(['+get', '+mget', '-hset'])
         assert acl['enabled'] is True
-        assert acl['flags'] == ['on']
+        assert 'on' in acl['flags']
         assert set(acl['keys']) == set([b'cache:*', b'objects:*'])
         assert len(acl['passwords']) == 2
 
@@ -154,7 +153,7 @@ class TestRedisCommands(object):
         assert set(acl['categories']) == set(['-@all', '+@set', '+@hash'])
         assert set(acl['commands']) == set(['+get', '+mget'])
         assert acl['enabled'] is True
-        assert acl['flags'] == ['on']
+        assert 'on' in acl['flags']
         assert set(acl['keys']) == set([b'cache:*', b'objects:*'])
         assert len(acl['passwords']) == 2
 
@@ -193,7 +192,7 @@ class TestRedisCommands(object):
 
         assert r.acl_setuser(username, enabled=False, reset=True)
         users = r.acl_list()
-        assert 'user %s off -@all' % username in users
+        assert len(users) == 2
 
     @skip_if_server_version_lt(REDIS_6_VERSION)
     def test_acl_setuser_categories_without_prefix_fails(self, r, request):

Reply via email to