def setUp(self): self.organization = Organization() self.organization.set_connection( user_name="test_user", password="******", end_point="http://api.test.com", session_verify=False )
class TestPerformRequest(unittest.TestCase): data = get_test_data() def setUp(self): self.organization = Organization() self.organization.set_connection( user_name="test_user", password="******", end_point="http://api.test.com", session_verify=False ) @unittest.skip("Not yet ready") def test__perform_request_with_no_user_name(self, mock): headers = self.data['auth-error-header'] response_data = self.data['auth-error-content'] self.organization.set_connection( user_name='', password="******", end_point="http://api.test.com", session_verify=False ) mock.get(requests_mock.ANY, json=response_data, headers=headers) with self.assertRaises(AuthError): self.organization._perform_request(self.organization.end_point) @unittest.skip("Not yet ready") def test__perform_request_with_with_none_as_user_name(self, mock): headers = self.data['auth-error-header'] response_data = self.data['auth-error-content'] self.organization.set_connection( user_name=None, password="******", end_point="http://api.test.com", session_verify=False ) mock.get(requests_mock.ANY, json=response_data, headers=headers) with self.assertRaises(AuthError): self.organization._perform_request(self.organization.end_point)