def testCreateModelWithEmptyInstanceIdArg(self): """ Test for the empty dimension field in json. """ data = utils.jsonEncode(self.modelsTestData["create_empty_instanceid_data"]) response = self.app.put("/", data, status="*", headers=self.headers) assertions.assertInvalidArgumentsError(self, response, "json")
def testCreateModelWithEmptyMetricArg(self): """ Test for the missing empty metric field in json. """ data = utils.jsonEncode(self.modelsTestData["create_empty_metric_data"]) response = self.app.put("/", data, status="*", headers=self.headers) assertions.assertInvalidArgumentsError(self, response, "json")
def testCreateModelWithInvalidRegionKey(self): """ Test for the invalid region field in json. """ data = utils.jsonEncode(self.modelsTestData["create_invalid_region_key"]) response = self.app.put("/", data, status="*", headers=self.headers) assertions.assertInvalidArgumentsError(self, response, "json")
def testCreateModelWithInvalidDatasourceArg(self): """ Test for the invalid metric field in json. """ data = utils.jsonEncode(self.modelsTestData["create_invalid_ds_data"]) response = self.app.put("/", data, status="*", headers=self.headers) assertions.assertInvalidArgumentsError(self, response, "json")
def testInvalidJsonModelsApi(self): """ Test for the invalid json. """ data = self.modelsTestData["create_data"] response = self.app.put("/", data, status="*", headers=self.headers) self.assertIn("No JSON object could be decoded", response.body) assertions.assertInvalidArgumentsError(self, response, "json")