def test_ykey_is_present(monkeypatch, tmp_path): ''' Test check if a YubiKey is current connected to the host ''' monkeypatch.setenv('HOME', str(tmp_path)) init_tmpdir(tmp_path, 'expired') from awsmfav2.cli import CLI cli = CLI() assert (cli._ykey_is_present())
def test_ykey_is_present(monkeypatch, tmp_path): """ Test check if a YubiKey is current connected to the host """ monkeypatch.setenv("HOME", str(tmp_path)) init_tmpdir(tmp_path, "expired") from awsmfav2.cli import CLI cli = CLI() assert cli._ykey_is_present()
def test_ykey_is_not_present_cli_arg(monkeypatch, tmp_path): ''' Test to try logic if a YubiKey is not connected with OATH cred passed from CLI ''' monkeypatch.setenv('HOME', str(tmp_path)) init_tmpdir(tmp_path, 'expired') from awsmfav2.cli import CLI with mock.patch.object(CLI, '_ykman_is_installed', return_value=False): cli = CLI() with pytest.raises(RuntimeError): assert (cli._ykey_is_present(ykey_count=0) == False)