def testCWNamespaceHandlerNamespaceAWSInvalidType(self): """ Test for Get '/_metrics/cloudwatch/AWS/<invalid_namespace>' response is validated for appropriate headers, body and status response is validated for error message """ response = self.app.get('/AWS/foo', status="*", headers=self.headers) assertions.assertNotFound(self, response) self.assertIn("Namespace 'AWS/foo' was not found", response.body)
def testGETRegionInvalid(self): """ 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 """ 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 testGETListInstancesForInvalidMetrcName(self): """ Test for Get '/_metrics/cloudwatch/<region-name>/AWS/<namespace>/metricName' with invalid metric response is validated for appropriate headers, body and status and reponse is validated for error message """ response = self.app.get("/us-west-2/AWS/EC2/GroupTotalInstances", status="*", headers=self.headers) assertions.assertNotFound(self, response) self.assertIn("Metric 'GroupTotalInstances' was not found", response.body)
def testGETListInstancesForInvalidNamespace(self): """ 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 """ response = self.app.get("/us-west-2/AWS/foo/CPUUtilization", status="*", headers=self.headers) assertions.assertNotFound(self, response) self.assertIn("Namespace 'AWS/foo' was not found", response.body)
def testGETMetricsInvalidRegion(self): """ Test for Get '/_metrics/cloudwatch/<region-name>/AWS/<namespace>/metricName' with invalid region response is validated for appropriate headers, body and status and reponse is validated for error message """ response = self.app.get("/fake-region/AWS/EC2/CPUUtilization", status="*", headers=self.headers) assertions.assertNotFound(self, response) self.assertIn("Region 'fake-region' was not found", response.body)
def testGETListInstancesForInvalidNamespaceWithInstanceId(self): """ Test for Get '/_metrics/cloudwatch/<region-name>/AWS/<namespace>/instances/<InstancdId>' with invalid namespace response is validated for appropriate headers, body and status and expected error message """ response = self.app.get("/us-west-2/AWS/foo/instances/%s" % VALID_EC2_INSTANCE["InstanceId"], status="*", headers=self.headers) assertions.assertNotFound(self, response) self.assertIn("Namespace 'AWS/foo' was not found", response.body)