def test_get_credential_file_env_var_missing_file(tmpdir, monkeypatch): tmp_creds = os.path.join(to_text(tmpdir), u'pÿspᴞӛgӫ TÈ$' '.creds') monkeypatch.setenv('NTLM_USER_FILE', to_native(tmp_creds)) actual = ntlm._get_credential_file() assert actual is None
def test_get_credential_file(tmpdir, monkeypatch): tmp_creds = os.path.join(to_text(tmpdir), u'pÿspᴞӛgӫ TÈ$' '.creds') with open(tmp_creds, mode='wb') as fd: fd.write(b"data") monkeypatch.setenv('NTLM_USER_FILE', to_native(tmp_creds)) actual = ntlm._get_credential_file() assert actual == to_text(tmp_creds)
def test_get_credential_file_no_env_var(): actual = ntlm._get_credential_file() assert actual is None