Add negative test for cfapi last_status route.
- Add test which will check, that cfapi returns expected error-code from last_status request, if requested instance_id doesn't exist. Change-Id: I2845aad6d08182f64dd4b6ce5f494c564c989c63 Targets: blueprint murano-cfapi-func-tests
This commit is contained in:
@@ -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)
|
||||
|
||||
|
@@ -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)
|
Reference in New Issue
Block a user