Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Session collection for testing libsecret backend #530

Merged
merged 2 commits into from Sep 12, 2021
Merged

Conversation

mitya57
Copy link
Collaborator

@mitya57 mitya57 commented Sep 11, 2021

This is something I needed to apply to make the tests pass for Debian package.

The Session collection is not documented in the specification and is specific to GNOME Keyring, but we do the same for testing SecretStorage backend:

keyring.preferred_collection = '/org/freedesktop/secrets/collection/session'

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

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
@jaraco
Copy link
Owner

jaraco commented Sep 11, 2021

I can't tell - are these preferred_collection attributes the same? Why do the tests set them to different values (/org/freedesktop/secrets/collection/session and session)?

@mitya57
Copy link
Collaborator Author

mitya57 commented Sep 12, 2021

@jaraco libsecret accepts only the alias, while SecretStorage accepts the full path.

Quoting libsecret documentation:

If collection is NULL, then the default collection will be used. Use SECRET_COLLECTION_SESSION to store the password in the session collection, which doesn't get stored across login sessions.

Where SECRET_COLLECTION_SESSION is defined as "session".

Maybe it would be better to use Secret.COLLECTION_SESSION, but I wanted to avoid an extra import in tests.

@mitya57
Copy link
Collaborator Author

mitya57 commented Sep 12, 2021

How it works can be seen here:
https://salsa.debian.org/python-team/packages/python-keyring/-/commits/debian/master/

In particular, a job without this patch failed and a job with this patch passed.

@jaraco jaraco merged commit bd93981 into main Sep 12, 2021
@jaraco jaraco deleted the session-collection branch September 12, 2021 17:10
jaraco added a commit that referenced this pull request Sep 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants