def test_authorization_manual_key(self): key = os.environ['AIRTABLE_API_KEY'] session = requests.Session() session.auth = AirtableAuth(api_key=key) resp = session.get('http://www.google.com') assert 'Authorization' in resp.request.headers assert 'Bearer' in resp.request.headers['Authorization']
def test_authorization_scheme(self): session = requests.Session() session.auth = AirtableAuth() with Mocker() as m: m.get('http://www.google.com', status_code=200) resp = session.get('http://www.google.com') assert 'Authorization' in resp.request.headers assert 'Bearer' in resp.request.headers['Authorization']
def test_authorization_key(self, table): FAKE_URL = "http://www.fake.com" session = requests.Session() session.auth = AirtableAuth(api_key="xxx") with Mocker() as m: m.get(FAKE_URL) resp = session.get(FAKE_URL) assert "Authorization" in resp.request.headers assert "Bearer xxx" in resp.request.headers["Authorization"]
def test_authorization_manual_call(self): request = requests.Request() auth = AirtableAuth(api_key="x") request = auth.__call__(request) assert "Authorization" in request.headers assert "Bearer" in request.headers["Authorization"]
def test_authorization_missing(self): os.environ.pop("AIRTABLE_API_KEY", None) with pytest.raises(KeyError): AirtableAuth()
def test_authorization_missing(self): key = os.environ.pop('AIRTABLE_API_KEY') session = requests.Session() with pytest.raises(KeyError): session.auth = AirtableAuth() os.environ['AIRTABLE_API_KEY'] = key
def test_authorization_manual_call(self): session = requests.Session() auth = AirtableAuth() session = auth.__call__(session) assert 'Authorization' in session.headers assert 'Bearer' in session.headers['Authorization']
def test_authorization_scheme(self): session = requests.Session() session.auth = AirtableAuth() resp = session.get('http://www.google.com') assert 'Authorization' in resp.request.headers assert 'Bearer' in resp.request.headers['Authorization']