zun-tempest-plugin/zun_tempest_plugin/tests/tempest/api/test_services.py
Hongbin Lu 50ec15fd93 Move docker network cleanup logic
Right now, both container and capsule tests are doing docker
network cleanup at the end of the tests. This commit moves
the cleanup logic to a common base class so that the code becomes
more DRY.

Change-Id: I9320f73f68b50954e57a1b9f0e3cc01c53ba102a
2018-12-09 21:36:51 +00:00

48 lines
1.6 KiB
Python

# 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.lib import decorators
from tempest.lib import exceptions
from zun_tempest_plugin.tests.tempest.api import clients
from zun_tempest_plugin.tests.tempest import base
class TestService(base.BaseZunTest):
credentials = ['primary', 'admin']
min_microversion = '1.7'
@classmethod
def get_client_manager(cls, credential_type=None, roles=None,
force_new=None):
manager = super(TestService, cls).get_client_manager(
credential_type=credential_type,
roles=roles,
force_new=force_new
)
return clients.Manager(manager.credentials)
@classmethod
def resource_setup(cls):
super(TestService, cls).resource_setup()
# TODO(pksingh): currently functional test doesn't support
# policy, will write another test after
# implementing policy in functional tests
@decorators.idempotent_id('a04f61f2-15ae-4200-83b7-1f311b101f36')
def test_service_list(self):
self.assertRaises(exceptions.Forbidden,
self.container_client.list_services)