Python keyring.set_keyring() Examples

The following are 6 code examples of keyring.set_keyring(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module keyring , or try the search function .
Example #1
Source File: conftest.py    From poetry with MIT License 5 votes vote down vote up
def config(config_source, auth_config_source, mocker):
    import keyring
    from keyring.backends.fail import Keyring

    keyring.set_keyring(Keyring())

    c = Config()
    c.merge(config_source.config)
    c.set_config_source(config_source)
    c.set_auth_config_source(auth_config_source)

    mocker.patch("poetry.factory.Factory.create_config", return_value=c)
    mocker.patch("poetry.config.config.Config.set_config_source")

    return c 
Example #2
Source File: test_password_manager.py    From poetry with MIT License 5 votes vote down vote up
def mock_available_backend(backend):
    import keyring

    keyring.set_keyring(backend) 
Example #3
Source File: test_password_manager.py    From poetry with MIT License 5 votes vote down vote up
def mock_unavailable_backend():
    import keyring
    from keyring.backends.fail import Keyring

    keyring.set_keyring(Keyring()) 
Example #4
Source File: test_password_manager.py    From poetry with MIT License 5 votes vote down vote up
def mock_chainer_backend(mocker):
    from keyring.backends.fail import Keyring

    mocker.patch("keyring.backend.get_all_keyring", [Keyring()])
    import keyring
    from keyring.backends.chainer import ChainerBackend

    keyring.set_keyring(ChainerBackend()) 
Example #5
Source File: test_provider_secrets.py    From msticpy with MIT License 5 votes vote down vote up
def setUp(self):
        keyring.set_keyring(KeyringTestBackend()) 
Example #6
Source File: app.py    From pushbullet-cli with MIT License 5 votes vote down vote up
def main():
    # The pycrypto encrypted keyring asks for a password in every launch. This is unacceptable.
    if isinstance(keyring.get_keyring(), keyrings.alt.file.EncryptedKeyring):
        keyring.set_keyring(keyrings.alt.file.PlaintextKeyring())