def testInvalidAuthHeaders(self, engineFactoryMock): # pylint: disable=W0613
   """
   negative test for authentication guarded route.
   invoke get request with invalid authentication headers
   response is validated for appropriate headers and body
   """
   invalidHeaders = getInvalidHTTPHeaders()
   response = self.app.get("", status="*", headers=invalidHeaders)
   assertions.assertInvalidAuthenticationResponse(self, response)
Beispiel #2
0
 def testInvalidAuthHeaders(self):
   """
   Negative test for authentication guarded route.
   invoke get request with invalid authentication headers
   response is validated for appropriate headers and body
   """
   invalidHeaders = getInvalidHTTPHeaders()
   response = self.app.get("/", status="*", headers=invalidHeaders)
   assertions.assertInvalidAuthenticationResponse(self, response)
Beispiel #3
0
 def testInvalidAuthHeaders(self, engineFactoryMock):  # pylint: disable=W0613
     """
 negative test for authentication guarded route.
 invoke get request with invalid authentication headers
 response is validated for appropriate headers and body
 """
     invalidHeaders = getInvalidHTTPHeaders()
     response = self.app.get("", status="*", headers=invalidHeaders)
     assertions.assertInvalidAuthenticationResponse(self, response)
  def setUp(self):
    self.headers = getDefaultHTTPHeaders(app_config)
    self.invalidHeaders = getInvalidHTTPHeaders()
    self.app = TestApp(annotations_api.app.wsgifunc())
    self.annotation = {
        "uid": "f4aa70b361f04036b0b39530900f38fa",
        "timestamp": "2014-01-25 05:00:00",
        "created": "2014-01-25 07:14:06",
        "device": "device1",
        "user": "******",
        "server": "us-west-2/AWS/EC2/i-f52075fe",
        "message": "My annotation",
        "data": None
    }
    self.instanceId = "%s/AWS/EC2/%s" % (
        VALID_EC2_INSTANCES["region"],
        VALID_EC2_INSTANCES["instanceId"])

    # Prepare request as annotation without "uid" or "created" fields
    self.request = self.annotation.copy()
    self.request["server"] = self.instanceId
    del self.request["uid"]
    del self.request["created"]