def setUp(self): self.configs = configs.copy() self.service = MockInsertRows(**self.configs) self.expected_kwargs = { 'expected_args': [self.service.get_server_url()] , 'data': '{"queryName": "' + query + '", "rows": "{id:1234}", "schemaName": "' + schema + '"}' , 'headers': {u'Content-Type': u'application/json'} , 'timeout': 30 } rows = '{id:1234}' self.args = [ server_context, schema, query, rows ]
class TestInsertRows(unittest.TestCase): def setUp(self): self.configs = configs.copy() self.service = MockInsertRows(**self.configs) self.expected_kwargs = { 'expected_args': [self.service.get_server_url()] , 'data': '{"queryName": "' + query + '", "rows": "{id:1234}", "schemaName": "' + schema + '"}' , 'headers': {u'Content-Type': u'application/json'} , 'timeout': 30 } rows = '{id:1234}' self.args = [ server_context, schema, query, rows ] def test_success(self): test = self success_test(test, self.service.get_successful_response(), insert_rows, *self.args, **self.expected_kwargs) def test_unauthorized(self): test = self throws_error_test(test, RequestAuthorizationError, self.service.get_unauthorized_response() , insert_rows, *self.args, **self.expected_kwargs) def test_query_not_found(self): test = self throws_error_test(test, QueryNotFoundError, self.service.get_query_not_found_response() , insert_rows, *self.args, **self.expected_kwargs) def test_server_not_found(self): test = self throws_error_test(test, ServerNotFoundError, self.service.get_server_not_found_response() , insert_rows, *self.args, **self.expected_kwargs) def test_general_error(self): test = self throws_error_test(test, RequestError, self.service.get_general_error_response() , insert_rows, *self.args, **self.expected_kwargs)