def testDeleteMultipleWithInvalidInstanceId(self): """ Test for post '/_instances' response is validated for appropriate headers, body and status invoke delete with invalid Instance id """ params = ["abcd1234"] response = self.app.delete("", params=app_utils.jsonEncode(params), headers=self.headers, status="*") assertions.assertNotFound(self, response) self.assertIn("Not able to delete", response.body)
def testGetListRegionMetricsEmptyResponse(self, adapterMock): """ Test for Get '/_metrics/cloudwatch/regions/<invalid-region-name>' response is validated for appropriate headers, body and status response is validated against expected error message """ adapterMock.return_value.describeRegions.return_value = self.regions response = self.app.get('/regions/fake-region', status="*", headers=self.headers) assertions.assertNotFound(self, response) self.assertIn("Region 'fake-region' was not found", response.body)
def testGetNamespaceAWSInvalidType(self, adapterMock): """ Test for Get '/_metrics/cloudwatch/AWS/<invalid_namespace>' response is validated for appropriate headers, body and status response is validated for error message """ adapterMock.return_value.describeRegions.return_value = self.regions adapterMock.return_value.describeSupportedMetrics.return_value = ( self.resources) response = self.app.get("/AWS/foo", headers=self.headers, status="*") assertions.assertNotFound(self, response) self.assertEqual("Namespace 'AWS/foo' was not found", response.body)
def testGetInstanceWithInvalidNamespace(self, adapterMock): """ Test for Get '/_metrics/cloudwatch/<region-name>/AWS/<namespace>/instances/<InstancdId>' with invalid InstancceId response is validated for appropriate headers, body and status """ adapterMock.return_value.describeRegions.return_value = self.regions adapterMock.return_value.describeSupportedMetrics.return_value = ( self.resources) response = self.app.get("/us-east-1/AWS/foo/instances/i-832311", headers=self.headers, status="*") assertions.assertNotFound(self, response) self.assertEqual(response.body, "Namespace 'AWS/foo' was not found")
def testGetMetricInvalidNamespace(self, adapterMock): """ Test for Get '/_metrics/cloudwatch/<region-name>/AWS/<namespace>/metricName' with invalid namespace response is validated for appropriate headers, body and status and reponse is validated for error message """ adapterMock.return_value.describeRegions.return_value = self.regions adapterMock.return_value.describeSupportedMetrics.return_value = ( self.resources) response = self.app.get("/us-east-1/AWS/foo/CPUUtilization", headers=self.headers, status="*") assertions.assertNotFound(self, response) self.assertEqual(response.body, "Namespace 'AWS/foo' was not found")
def testGetInstanceWithInvalidRegion(self, adapterMock): """ Test for Get '/_metrics/cloudwatch/<region-name>/AWS/<namespace>/instances/' with invalid region response is validated for appropriate headers, body and status and error message """ adapterMock.return_value.describeRegions.return_value = self.regions adapterMock.return_value.describeSupportedMetrics.return_value = ( self.resources) response = self.app.get("/fake-region/AWS/EC2/instances/i-832311", headers=self.headers, status="*") assertions.assertNotFound(self, response) self.assertEqual(response.body, "Region 'fake-region' was not found")