Esempio n. 1
0
 def test_get_stack(self):
     """get_stack performs a GET on the given stack URL."""
     log = mock_log()
     treq = self._treq(code=200, method='get',
                       json_content={'hello': 'world'})
     client = HeatClient('my-auth-token', log, treq)
     result = client.get_stack('http://heat-url/my-stack')
     self.assertEqual(self.successResultOf(result), {'hello': 'world'})
Esempio n. 2
0
 def test_get_stack_error(self):
     """Non-200 codes from getting a stack are considered an APIError."""
     log = mock_log()
     treq = self._treq(code=201, method='get',
                       json_content={'hello': 'world'})
     client = HeatClient('my-auth-token', log, treq)
     result = client.get_stack('http://heat-url/my-stack')
     failure = self.failureResultOf(result)
     failure.trap(APIError)