Exemple #1
0
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())
Exemple #2
0
def with_chained_keyring(mocker: "MockerFixture") -> None:
    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())
Exemple #3
0
def with_chained_null_keyring(mocker: MockerFixture) -> None:
    from keyring.backends.null import Keyring

    mocker.patch("keyring.backend.get_all_keyring", lambda: [Keyring()])
    import keyring

    from keyring.backends.chainer import ChainerBackend

    keyring.set_keyring(ChainerBackend())
Exemple #4
0
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
Exemple #5
0
def config(
    config_source: DictConfigSource,
    auth_config_source: DictConfigSource,
    mocker: MockerFixture,
) -> Config:
    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.config.config.Config.create", return_value=c)
    mocker.patch("poetry.config.config.Config.set_config_source")

    return c
Exemple #6
0
def with_fail_keyring() -> None:
    import keyring

    from keyring.backends.fail import Keyring

    keyring.set_keyring(Keyring())
Exemple #7
0
def with_null_keyring() -> None:
    import keyring

    from keyring.backends.null import Keyring

    keyring.set_keyring(Keyring())
Exemple #8
0
def mock_unavailable_backend():
    import keyring
    from keyring.backends.fail import Keyring

    keyring.set_keyring(Keyring())