Accepting request 838789 from home:frispete:python
- Fold -tests package into mail package again - Apply fix-kwallet-tests.patch - fix packaging tests - Package tests in separate package $flavor-tests Allows packages, that depend on these tests, to build successfully e.g. keyrings.cryptfile OBS-URL: https://build.opensuse.org/request/show/838789 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-keyring?expand=0&rev=86
This commit is contained in:
parent
2397031c33
commit
61c07da8d6
95
fix-kwallet-tests.patch
Normal file
95
fix-kwallet-tests.patch
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
diff --git a/tests/backends/test_kwallet.py b/tests/backends/test_kwallet.py
|
||||||
|
index 68cb4c7..f2d1638 100644
|
||||||
|
--- a/tests/backends/test_kwallet.py
|
||||||
|
+++ b/tests/backends/test_kwallet.py
|
||||||
|
@@ -6,6 +6,7 @@ from keyring.testing.backend import BackendBasicTests
|
||||||
|
|
||||||
|
@pytest.mark.skipif(not kwallet.DBusKeyring.viable, reason="KWallet5 unavailable")
|
||||||
|
class TestDBusKWallet(BackendBasicTests):
|
||||||
|
+ __test__ = True
|
||||||
|
|
||||||
|
# Remove '@' from service name as this is not supported in service names
|
||||||
|
# '@' will cause troubles during migration of kwallet entries
|
||||||
|
@@ -14,66 +15,27 @@ class TestDBusKWallet(BackendBasicTests):
|
||||||
|
def init_keyring(self):
|
||||||
|
return kwallet.DBusKeyring()
|
||||||
|
|
||||||
|
- def cleanup(self):
|
||||||
|
- for item in self.credentials_created:
|
||||||
|
- # Suppress errors, as only one pre/post migration item will be
|
||||||
|
- # present
|
||||||
|
- try:
|
||||||
|
- self.keyring.delete_password(*item)
|
||||||
|
- except BaseException:
|
||||||
|
- pass
|
||||||
|
-
|
||||||
|
- # TODO Remove empty folders created during tests
|
||||||
|
-
|
||||||
|
- def set_password(self, service, username, password, old_format=False):
|
||||||
|
- # set the password and save the result so the test runner can clean
|
||||||
|
- # up after if necessary.
|
||||||
|
- self.credentials_created.add((service, username))
|
||||||
|
-
|
||||||
|
- if old_format:
|
||||||
|
- username = username + '@' + service
|
||||||
|
- service = 'Python'
|
||||||
|
-
|
||||||
|
- super().set_password(service, username, password)
|
||||||
|
-
|
||||||
|
- def check_set_get(self, service, username, password):
|
||||||
|
+ def test_credential(self):
|
||||||
|
keyring = self.keyring
|
||||||
|
|
||||||
|
- # for the non-existent password
|
||||||
|
- self.assertEqual(keyring.get_password(service, username), None)
|
||||||
|
+ # not supported from kwallets
|
||||||
|
+ #cred = keyring.get_credential('service', None)
|
||||||
|
+ #assert cred is None
|
||||||
|
|
||||||
|
- # common usage
|
||||||
|
- self.set_password(service, username, password, True)
|
||||||
|
- # re-init keyring to force migration
|
||||||
|
- self.keyring = keyring = self.init_keyring()
|
||||||
|
- ret_password = keyring.get_password(service, username)
|
||||||
|
- self.assertEqual(
|
||||||
|
- ret_password,
|
||||||
|
- password,
|
||||||
|
- "Incorrect password for username: '%s' "
|
||||||
|
- "on service: '%s'. '%s' != '%s'"
|
||||||
|
- % (service, username, ret_password, password),
|
||||||
|
- )
|
||||||
|
+ self.set_password('service1', 'user1', 'password1')
|
||||||
|
+ self.set_password('service1', 'user2', 'password2')
|
||||||
|
|
||||||
|
- # for the empty password
|
||||||
|
- self.set_password(service, username, "", True)
|
||||||
|
- # re-init keyring to force migration
|
||||||
|
- self.keyring = keyring = self.init_keyring()
|
||||||
|
- ret_password = keyring.get_password(service, username)
|
||||||
|
- self.assertEqual(
|
||||||
|
- ret_password,
|
||||||
|
- "",
|
||||||
|
- "Incorrect password for username: '%s' "
|
||||||
|
- "on service: '%s'. '%s' != '%s'" % (service, username, ret_password, ""),
|
||||||
|
+ cred = keyring.get_credential('service1', None)
|
||||||
|
+ assert cred is None or (cred.username, cred.password) in (
|
||||||
|
+ ('user1', 'password1'),
|
||||||
|
+ ('user2', 'password2'),
|
||||||
|
)
|
||||||
|
- ret_password = keyring.get_password('Python', username + '@' + service)
|
||||||
|
- self.assertEqual(
|
||||||
|
- ret_password,
|
||||||
|
- None,
|
||||||
|
- "Not 'None' password returned for username: '%s' "
|
||||||
|
- "on service: '%s'. '%s' != '%s'. Passwords from old "
|
||||||
|
- "folder should be deleted during migration."
|
||||||
|
- % (service, username, ret_password, None),
|
||||||
|
+
|
||||||
|
+ cred = keyring.get_credential('service1', 'user2')
|
||||||
|
+ assert cred is not None
|
||||||
|
+ assert (cred.username, cred.password) in (
|
||||||
|
+ ('user1', 'password1'),
|
||||||
|
+ ('user2', 'password2'),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
@ -1,3 +1,13 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Sep 30 12:35:11 UTC 2020 - Hans-Peter Jansen <hpj@urpla.net>
|
||||||
|
|
||||||
|
- Fold -tests package into mail package again
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Sep 21 16:25:13 UTC 2020 - Hans-Peter Jansen <hpj@urpla.net>
|
||||||
|
|
||||||
|
- Apply fix-kwallet-tests.patch
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Tue Jun 2 16:32:46 UTC 2020 - Dirk Mueller <dmueller@suse.com>
|
Tue Jun 2 16:32:46 UTC 2020 - Dirk Mueller <dmueller@suse.com>
|
||||||
|
|
||||||
@ -17,6 +27,11 @@ Mon May 25 06:50:30 UTC 2020 - Petr Gajdos <pgajdos@suse.com>
|
|||||||
|
|
||||||
- %python3_only -> %python_alternative
|
- %python3_only -> %python_alternative
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Sat May 2 17:54:41 UTC 2020 - Hans-Peter Jansen <hpj@urpla.net>
|
||||||
|
|
||||||
|
- fix packaging tests
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Thu Apr 16 08:27:33 UTC 2020 - pgajdos@suse.com
|
Thu Apr 16 08:27:33 UTC 2020 - pgajdos@suse.com
|
||||||
|
|
||||||
@ -93,6 +108,13 @@ Wed Mar 6 08:40:32 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
|
|||||||
- Revert the test removal pending fix of upstream bug:
|
- Revert the test removal pending fix of upstream bug:
|
||||||
https://github.com/jaraco/keyrings.alt/issues/33
|
https://github.com/jaraco/keyrings.alt/issues/33
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Sat Mar 2 10:41:01 UTC 2019 - Hans-Peter Jansen <hpj@urpla.net>
|
||||||
|
|
||||||
|
- Package tests in separate package $flavor-tests
|
||||||
|
Allows packages, that depend on these tests, to build successfully
|
||||||
|
e.g. keyrings.cryptfile
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Tue Feb 26 13:10:57 UTC 2019 - John Vandenberg <jayvdb@gmail.com>
|
Tue Feb 26 13:10:57 UTC 2019 - John Vandenberg <jayvdb@gmail.com>
|
||||||
|
|
||||||
|
@ -23,8 +23,10 @@ Version: 21.2.1
|
|||||||
Release: 0
|
Release: 0
|
||||||
Summary: System keyring service access from Python
|
Summary: System keyring service access from Python
|
||||||
License: Python-2.0 AND MIT
|
License: Python-2.0 AND MIT
|
||||||
|
Group: Development/Languages/Python
|
||||||
URL: https://github.com/jaraco/keyring
|
URL: https://github.com/jaraco/keyring
|
||||||
Source: https://files.pythonhosted.org/packages/source/k/keyring/keyring-%{version}.tar.gz
|
Source: https://files.pythonhosted.org/packages/source/k/keyring/keyring-%{version}.tar.gz
|
||||||
|
Patch: fix-kwallet-tests.patch
|
||||||
BuildRequires: %{python_module SecretStorage >= 3}
|
BuildRequires: %{python_module SecretStorage >= 3}
|
||||||
BuildRequires: %{python_module entrypoints}
|
BuildRequires: %{python_module entrypoints}
|
||||||
BuildRequires: %{python_module importlib-metadata}
|
BuildRequires: %{python_module importlib-metadata}
|
||||||
@ -50,6 +52,7 @@ from python. It can be used in any application that needs safe password storage.
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n keyring-%{version}
|
%setup -q -n keyring-%{version}
|
||||||
|
%patch -p1
|
||||||
# For rpmlint warning: remove shebang from python library:
|
# For rpmlint warning: remove shebang from python library:
|
||||||
sed -i '/^#!/d' keyring/cli.py
|
sed -i '/^#!/d' keyring/cli.py
|
||||||
sed -i -e 's,--flake8,,' -e 's,--black,,' -e 's,--cov,,' pytest.ini
|
sed -i -e 's,--flake8,,' -e 's,--black,,' -e 's,--cov,,' pytest.ini
|
||||||
|
Loading…
Reference in New Issue
Block a user