Exemple #1
0
    def test_good_response_good_entity_bad_status(self):
        client, config, snapshot_model, response = self.get_mocks()

        recieved_status = "error"
        poll_rate = 1
        snapshot_model.status = recieved_status
        response.entity = snapshot_model
        client.get_snapshot_info = MagicMock(return_value=response)
        behavior = VolumesAPI_Behaviors(client, config)

        with self.assertRaises(VolumesAPIBehaviorException):
            behavior.wait_for_snapshot_status(
                self.defaults.snapshot_name, self.defaults.expected_status, self.defaults.timeout, poll_rate=poll_rate
            )
    def test_good_response_code_empty_entity(self):
        client, config, snapshot_model, response = self.get_mocks()

        response.entity = None
        response.status_code = '200'
        client.get_snapshot_info = MagicMock(return_value=response)
        behavior = VolumesAPI_Behaviors(client, config)

        with self.assertRaises(VolumesAPIBehaviorException):
            behavior.wait_for_snapshot_status(
                self.defaults.snapshot_name,
                self.defaults.expected_status,
                self.defaults.timeout,
                poll_rate=self.defaults.poll_rate)
Exemple #3
0
    def test_good_response_code_empty_entity(self):
        client, config, snapshot_model, response = self.get_mocks()

        response.entity = None
        response.status_code = "200"
        client.get_snapshot_info = MagicMock(return_value=response)
        behavior = VolumesAPI_Behaviors(client, config)

        with self.assertRaises(VolumesAPIBehaviorException):
            behavior.wait_for_snapshot_status(
                self.defaults.snapshot_name,
                self.defaults.expected_status,
                self.defaults.timeout,
                poll_rate=self.defaults.poll_rate,
            )
    def test_good_response_good_entity_bad_status(self):
        client, config, snapshot_model, response = self.get_mocks()

        recieved_status = 'error'
        poll_rate = 1
        snapshot_model.status = recieved_status
        response.entity = snapshot_model
        client.get_snapshot_info = MagicMock(return_value=response)
        behavior = VolumesAPI_Behaviors(client, config)

        with self.assertRaises(VolumesAPIBehaviorException):
            behavior.wait_for_snapshot_status(self.defaults.snapshot_name,
                                              self.defaults.expected_status,
                                              self.defaults.timeout,
                                              poll_rate=poll_rate)
Exemple #5
0
    def test_good_response_code_config_wait_period(self):
        client, config, snapshot_model, response = self.get_mocks()

        behavior = VolumesAPI_Behaviors(client, config)
        resp = behavior.wait_for_snapshot_status(
            self.defaults.snapshot_name, self.defaults.expected_status, self.defaults.timeout
        )

        self.assertIsNone(resp)
    def test_good_response_code_config_wait_period(self):
        client, config, snapshot_model, response = self.get_mocks()

        behavior = VolumesAPI_Behaviors(client, config)
        resp = behavior.wait_for_snapshot_status(self.defaults.snapshot_name,
                                                 self.defaults.expected_status,
                                                 self.defaults.timeout)

        self.assertIsNone(resp)
    def test_good_response_code_manual_poll_rate(self):
        client, config, snapshot_model, response = self.get_mocks()

        behavior = VolumesAPI_Behaviors(client, config)
        resp = behavior.wait_for_snapshot_status(
            self.defaults.snapshot_id,
            self.defaults.expected_status,
            self.defaults.timeout,
            poll_rate=self.defaults.poll_rate)

        self.assertIsNone(resp)
Exemple #8
0
    def test_good_response_code_manual_poll_rate(self):
        client, config, snapshot_model, response = self.get_mocks()

        behavior = VolumesAPI_Behaviors(client, config)
        resp = behavior.wait_for_snapshot_status(
            self.defaults.snapshot_id,
            self.defaults.expected_status,
            self.defaults.timeout,
            poll_rate=self.defaults.poll_rate,
        )

        self.assertIsNone(resp)