예제 #1
0
 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']
예제 #2
0
 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']
예제 #3
0
 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"]
예제 #4
0
 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"]
예제 #5
0
 def test_authorization_missing(self):
     os.environ.pop("AIRTABLE_API_KEY", None)
     with pytest.raises(KeyError):
         AirtableAuth()
예제 #6
0
 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
예제 #7
0
 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']
예제 #8
0
 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']