- Add account-defaults-redis.patch which fixes failing tests by
taking into consideration redis defaults, not overwriting them (gh#andymccurdy/redis-py#1499). OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-redis?expand=0&rev=58
This commit is contained in:
parent
23791a97f7
commit
8d1c0f81d0
87
account-defaults-redis.patch
Normal file
87
account-defaults-redis.patch
Normal file
@ -0,0 +1,87 @@
|
||||
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):
|
@ -1,3 +1,10 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Jul 16 09:15:51 UTC 2021 - Matej Cepl <mcepl@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).
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Mar 10 12:41:14 UTC 2021 - Matej Cepl <mcepl@suse.com>
|
||||
|
||||
|
@ -25,6 +25,9 @@ License: MIT
|
||||
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 mcepl@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 @@ BuildArch: noarch
|
||||
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 @@ The Python interface to the Redis key-value store.
|
||||
|
||||
%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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user