Esempio n. 1
0
def test_set_password_when_using_file_fallback_and_user_rejects_does_not_saves_password(
        profile, keyring_password_setter, get_keyring, user_disagreement):
    get_keyring.return_value.priority = 0.5
    keyring_password_getter.return_value = "test_password"
    profile.name = "profile_name"
    profile.username = "******"
    password.set_password(profile, "test_password")
    assert not keyring_password_setter.call_count
Esempio n. 2
0
def test_set_password_uses_expected_service_name_username_and_password(
        profile, keyring_password_setter, keyring_password_getter):
    keyring_password_getter.return_value = "test_password"
    profile.name = "profile_name"
    profile.username = "******"
    password.set_password(profile, "test_password")
    expected_service_name = "code42cli::profile_name"
    keyring_password_setter.assert_called_once_with(expected_service_name,
                                                    profile.username,
                                                    "test_password")
Esempio n. 3
0
def test_set_password_when_using_file_fallback_and_user_accepts_saves_password(
    profile,
    keyring_password_setter,
    keyring_password_getter,
    get_keyring,
    user_agreement,
):
    keyring_password_getter.return_value = "test_password"
    profile.name = "profile_name"
    profile.username = "******"
    password.set_password(profile, "test_password")
    expected_service_name = "code42cli::profile_name"
    keyring_password_setter.assert_called_once_with(
        expected_service_name, profile.username, "test_password"
    )
Esempio n. 4
0
def set_password(new_password, profile_name=None):
    profile = get_profile(profile_name)
    password.set_password(profile, new_password)