Add domains negative test

Created domain can't be removed by simple call, it's necessary to
disable it at first and then remove it. Otherwise Forbidden exception
will be raised.

Change-Id: I20a9d58c3bcc07c5483b43f7cba13f82d177c46a
This commit is contained in:
Martin Pavlasek 2015-05-21 23:58:00 +02:00
parent 4c3f2ab56e
commit 17dc28dd39
1 changed files with 38 additions and 0 deletions

View File

@ -0,0 +1,38 @@
# Copyright 2015 Red Hat 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.api.identity import base
from tempest import test
from tempest_lib.common.utils import data_utils
from tempest_lib import exceptions as lib_exc
class DomainsNegativeTestJSON(base.BaseIdentityV3AdminTest):
_interface = 'json'
@test.attr(type=['negative', 'gate'])
@test.idempotent_id('1f3fbff5-4e44-400d-9ca1-d953f05f609b')
def test_delete_active_domain(self):
d_name = data_utils.rand_name('domain')
d_desc = data_utils.rand_name('domain-desc')
domain = self.client.create_domain(d_name, description=d_desc)
domain_id = domain['id']
self.addCleanup(self.delete_domain, domain_id)
# domain need to be disabled before deleting
self.assertRaises(lib_exc.Forbidden, self.client.delete_domain,
domain_id)