Skip to content

Commit

Permalink
Use Session collection for testing libsecret backend
Browse files Browse the repository at this point in the history
It is specific to GNOME Keyring, but we do the same for testing
SecretStorage backend.

The login collection is not available in a clean environment, which
results in this error:

No such interface “org.freedesktop.Secret.Collection” on object at path
/org/freedesktop/secrets/collection/login
  • Loading branch information
mitya57 committed Sep 11, 2021
1 parent fb37652 commit 2e7aa26
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion keyring/backends/libsecret.py
Expand Up @@ -77,7 +77,8 @@ def get_password(self, service, username):

def set_password(self, service, username, password):
"""Set password for the username of the service"""
collection = Secret.COLLECTION_DEFAULT
collection = getattr(self, 'preferred_collection',
Secret.COLLECTION_DEFAULT)
attributes = {
"application": self.appid,
"service": service,
Expand Down
1 change: 1 addition & 0 deletions tests/backends/test_libsecret.py
Expand Up @@ -18,6 +18,7 @@ def init_keyring(self):
"password prompts are for this keyring"
)
keyring = libsecret.Keyring()
keyring.preferred_collection = 'session'
return keyring


Expand Down

0 comments on commit 2e7aa26

Please sign in to comment.