def test_invalid_token_v2(self):
     response = MockResponse("http://some-cf-url",
                             401,
                             text=json.dumps(
                                 dict(code=1000,
                                      error_code="CF-InvalidAuthToken")))
     result = CloudFoundryClient._is_token_expired(response)
     self.assertTrue(result)
Esempio n. 2
0
 def test_invalid_token_v3(self):
     response = MockResponse(
         'http://some-cf-url',
         401,
         text=json.dumps(
             dict(errors=[
                 dict(code=666, title='Some-Error', detail='Error detail'),
                 dict(code=1000,
                      title='CF-InvalidAuthToken',
                      detail='Invalid token')
             ])))
     result = CloudFoundryClient._is_token_expired(response)
     self.assertTrue(result)
 def test_invalid_token_v3(self):
     response = MockResponse(
         "http://some-cf-url",
         401,
         text=json.dumps(
             dict(errors=[
                 dict(code=666, title="Some-Error", detail="Error detail"),
                 dict(code=1000,
                      title="CF-InvalidAuthToken",
                      detail="Invalid token"),
             ])),
     )
     result = CloudFoundryClient._is_token_expired(response)
     self.assertTrue(result)