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

Test cases are failing while trying to call keyring #100

Open
drewsonne opened this issue Apr 25, 2018 · 0 comments
Open

Test cases are failing while trying to call keyring #100

drewsonne opened this issue Apr 25, 2018 · 0 comments

Comments

@drewsonne
Copy link
Contributor

drewsonne commented Apr 25, 2018

Expected Behavior

Testcases should pass and shoulds mock out keyring, so as not to call any OS keychains

Current Behavior

It appears the test cases are currently calling keyring on the master branch in travis. https://travis-ci.org/physera/onelogin-aws-cli/jobs/370302728

Possible Solution

Mock the keyring functions or their wrappers in the onelogin_aws_cli.Credentials class.

Steps to Reproduce

  1. View https://travis-ci.org/physera/onelogin-aws-cli/jobs/370302728

Context (Environment)

I'm not sure how the PR build succeeded and the master branch merge failed, but it looks like it is.
We probably shouldn't call keyring during tests anyway and make sure to mock it out in the test cases which may call it.

Possible Implementation

An example of how to mock it can be seen when mocking getpass:

Alternatively, use a MagicMock to mock the wrappers. For example,

self.get_saml_assertion_mock = MagicMock(return_value=Namespace(
to mock out onelogin_aws_cli.Credentials._load_password_from_keychain and onelogin_aws_cli.Credentials._save_password_to_keychain

@drewsonne drewsonne changed the title Test cases failing trying to call keyring Test cases are failing while trying to call keyring Apr 25, 2018
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

No branches or pull requests

1 participant