diff --git a/murano_tempest_tests/services/service_broker/service_broker_client.py b/murano_tempest_tests/services/service_broker/service_broker_client.py index 07ed6509..12ded1b4 100644 --- a/murano_tempest_tests/services/service_broker/service_broker_client.py +++ b/murano_tempest_tests/services/service_broker/service_broker_client.py @@ -18,7 +18,6 @@ import json from tempest import config from tempest_lib.common import rest_client -from tempest_lib import exceptions from murano_tempest_tests import utils @@ -85,12 +84,7 @@ class ServiceBrokerClient(rest_client.RestClient): def get_last_status(self, instance_id): uri = '/v2/service_instances/{0}/last_operation'.format(instance_id) - try: - resp, body = self.get(uri, headers=self.headers) - except exceptions.UnexpectedResponseCode as e: - # Tempest REST client can't catch this code. - if int(e.resp['status']) == 410: - return '{}' + resp, body = self.get(uri, headers=self.headers) self.expected_success([200, 202], resp.status) return self._parse_resp(body) diff --git a/murano_tempest_tests/tests/api/service_broker/test_service_broker_negative.py b/murano_tempest_tests/tests/api/service_broker/test_service_broker_negative.py new file mode 100644 index 00000000..7ca2e9b2 --- /dev/null +++ b/murano_tempest_tests/tests/api/service_broker/test_service_broker_negative.py @@ -0,0 +1,33 @@ +# Copyright (c) 2015 Mirantis, Inc. +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from tempest import test +from tempest_lib import exceptions + +from murano_tempest_tests.tests.api.service_broker import base +from murano_tempest_tests import utils + + +class ServiceBrokerNegativeTest(base.BaseServiceBrokerAdminTest): + + @test.attr(type=['gate', 'negative']) + def test_get_status_with_not_present_instance_id(self): + not_present_instance_id = utils.generate_uuid() + # TODO(freerunner) Tempest REST client can't catch code 410 yet. + # Need to update the test, when tempest-lib will have this code. + self.assertRaises( + exceptions.UnexpectedResponseCode, + self.service_broker_client.get_last_status, + not_present_instance_id)