def test_check_response_500_json(self):
     response = MockResponse("http://some-cf-url",
                             500,
                             text=json.dumps(
                                 dict(entity="entityTest",
                                      metadata="metadataTest")))
     with self.assertRaisesRegex(InvalidStatusCode, "metadataTest"):
         CloudFoundryClient._check_response(response)
Пример #2
0
 def test_check_response_500_with_vcap(self):
     response = MockResponse(
         "http://some-cf-url",
         500,
         text=json.dumps(dict(entity="entityTest", metadata="metadataTest")),
         headers={"x-vcap-request-id": "testVcap"},
     )
     with self.assertRaisesRegex(InvalidStatusCode, "testVcap"):
         CloudFoundryClient._check_response(response)
 def test_check_response_200(self):
     response = MockResponse("http://some-cf-url",
                             200,
                             text=json.dumps(
                                 dict(entity="entityTest",
                                      metadata="metadataTest")))
     self.assertIsNotNone(CloudFoundryClient._check_response(response))
Пример #4
0
 def test_check_response_500_text(self):
     response = MockResponse("http://some-cf-url", 500, text="This is test text")
     with self.assertRaisesRegex(InvalidStatusCode, "This is test text"):
         CloudFoundryClient._check_response(response)