-
-
Notifications
You must be signed in to change notification settings - Fork 148
/
test_libsecret.py
31 lines (25 loc) · 886 Bytes
/
test_libsecret.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import pytest
from keyring.testing.backend import BackendBasicTests
from keyring.testing.util import NoNoneDictMutator
from keyring.backends import libsecret
@pytest.mark.skipif(
not libsecret.Keyring.viable,
reason="libsecret package is needed for LibSecretKeyring",
)
class TestLibSecretKeyring(BackendBasicTests):
__test__ = True
def init_keyring(self):
print(
"Testing LibSecretKeyring; the following "
"password prompts are for this keyring"
)
keyring = libsecret.Keyring()
keyring.preferred_collection = 'session'
return keyring
class TestUnits:
def test_supported_no_libsecret(self):
"""
LibSecretKeyring is not viable if Secret can't be imported.
"""
with NoNoneDictMutator(libsecret.__dict__, Secret=None):
assert not libsecret.Keyring.viable