def test_set_password_uses_expected_profile_name(config_accessor, password_setter): mock_section = MockSection("testprofilename") config_accessor.get_profile.return_value = mock_section test_profile = "testprofilename" cliprofile.set_password("newpassword", test_profile) assert password_setter.call_args[0][0].name == test_profile
def _set_pw(profile_name, password): c42profile = cliprofile.get_profile(profile_name) try: validate_connection(c42profile.authority_url, c42profile.username, password) except Exception: secho("Password not stored!", bold=True) raise cliprofile.set_password(password, c42profile.name)
def _set_pw(profile_name, password, debug, totp=None): c42profile = cliprofile.get_profile(profile_name) try: create_sdk(c42profile, is_debug_mode=debug, password=password, totp=totp) except Exception: secho("Password not stored!", bold=True) raise cliprofile.set_password(password, c42profile.name) return c42profile.name
def _set_pw(profile_name, password): c42profile = cliprofile.get_profile(profile_name) try: create_sdk(c42profile, is_debug_mode=False, password=password) except Py42MFARequiredError: echo( "Multi-factor account detected. `--totp <token>` option will be required for all code42 invocations." ) except Exception: secho("Password not stored!", bold=True) raise cliprofile.set_password(password, c42profile.name) return c42profile.name