Beispiel #1
0
 def test__get_headers_Should_ReturnHeaders_When_Called(self, *patches):
     client = RESTclient('hostname1.company.com')
     result = client.get_headers()
     expected_result = {
         'Content-Type': 'application/json',
     }
     self.assertEqual(result, expected_result)
Beispiel #2
0
 def test__get_headers_Should_ReturnHeaders_When_ApiKey(self, *patches):
     client = RESTclient('hostname1.company.com', api_key='some-api-key')
     result = client.get_headers()
     expected_result = {
         'Content-Type': 'application/json',
         'x-api-key': 'some-api-key'
     }
     self.assertEqual(result, expected_result)
Beispiel #3
0
 def test__get_headers_Should_ReturnHeaders_When_BearerToken(
         self, *patches):
     client = RESTclient('hostname1.company.com', bearer_token='token')
     result = client.get_headers()
     expected_result = {
         'Content-Type': 'application/json',
         'Authorization': 'Bearer token'
     }
     self.assertEqual(result, expected_result)
Beispiel #4
0
 def test__get_headers_Should_SetAuthorizationHeader_When_UsernamePasswordAttributesExist(
         self, *patches):
     client = RESTclient('hostname', username='******', password='******')
     results = client.get_headers()
     self.assertTrue('Authorization' in results)
     self.assertTrue('Basic' in results['Authorization'])