Esempio n. 1
0
    def test_should_handle_unexpected_responses_when_retrieving_init_state(
            self, mock_request):
        client = DefaultInitApi(api_url=self.url,
                                connect_retries=1,
                                backoff_factor=2,
                                context=DefaultHttpsContext(verify=False))
        mock_request.return_value = MockResponse.empty()

        with self.assertRaises(Abort):
            client.state()
Esempio n. 2
0
    def test_should_stop_an_active_operation(self, mock_request):
        client = DefaultClientApi(api_url=self.url,
                                  api_token=self.token,
                                  context=DefaultHttpsContext(verify=False))
        mock_request.return_value = MockResponse.empty()

        operation = uuid4()
        self.assertEqual(client.operation_stop(operation), {
            'successful': True,
            'operation': None
        })

        self.assert_valid_request(
            mock=mock_request,
            expected_method='put',
            expected_url='/operations/{}/stop'.format(operation))