def test_api_url_read_from_env_var(self, unused_jwt_encode, mock_glob, open_mock): apikey_auth = SeerApiKeyAuth(api_key_id='id', api_key_path=None, api_key='key') params = apikey_auth.get_connection_parameters() assert apikey_auth.api_url == 'https://random-sdk.url' assert params['url'] == 'https://random-sdk.url/graphql' open_mock.assert_not_called() mock_glob.assert_not_called()
def test_get_connection_parameters_no_decode(self, unused_jwt_encode, unused_glob, open_mock): apikey_auth = SeerApiKeyAuth(api_key_id='id', api_key_path='path/seerpy.pem') params = apikey_auth.get_connection_parameters() assert params == { 'url': 'https://sdk-au.seermedical.com/api/graphql', 'headers': { 'Authorization': 'Bearer an_unencoded_key' }, 'use_json': True, 'timeout': 30 } open_mock.assert_called_with('path/seerpy.pem', 'r')