Basic object store container functional tests
Basic object store container functional tests along with some changes so that setUp and tearDown can create and destroy the test object. The group_regex gets each class to run on one process. Change-Id: Ibffb3cd61976e7db3c4199c627b30af2fa15f652
This commit is contained in:
parent
d4360b90a5
commit
fbfbd68cef
@ -4,4 +4,5 @@ test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
|
||||
OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \
|
||||
${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./openstack/tests/unit} $LISTOPT $IDOPTION
|
||||
test_id_option=--load-list $IDFILE
|
||||
test_list_option=--list
|
||||
test_list_option=--list
|
||||
group_regex=([^\.]+\.)+
|
||||
|
@ -16,16 +16,24 @@ import os_client_config
|
||||
|
||||
from openstack import connection
|
||||
from openstack import user_preference
|
||||
from openstack import utils
|
||||
|
||||
|
||||
class BaseFunctionalTest(unittest.TestCase):
|
||||
def setUp(self):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
test_cloud = os_client_config.OpenStackConfig().get_one_cloud(
|
||||
'test_cloud')
|
||||
|
||||
pref = user_preference.UserPreference()
|
||||
pref.set_region(pref.ALL, test_cloud.region)
|
||||
if test_cloud.debug:
|
||||
utils.enable_logging(True)
|
||||
|
||||
self.conn = connection.Connection(
|
||||
preference=pref,
|
||||
**test_cloud.config['auth'])
|
||||
auth = test_cloud.config['auth']
|
||||
cls.conn = connection.Connection(preference=pref, **auth)
|
||||
|
||||
@classmethod
|
||||
def assertIs(cls, expected, actual):
|
||||
if expected != actual:
|
||||
raise Exception(expected + ' != ' + actual)
|
||||
|
0
openstack/tests/functional/object/__init__.py
Normal file
0
openstack/tests/functional/object/__init__.py
Normal file
0
openstack/tests/functional/object/v1/__init__.py
Normal file
0
openstack/tests/functional/object/v1/__init__.py
Normal file
39
openstack/tests/functional/object/v1/test_container.py
Normal file
39
openstack/tests/functional/object/v1/test_container.py
Normal file
@ -0,0 +1,39 @@
|
||||
# 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.
|
||||
|
||||
import uuid
|
||||
|
||||
from openstack.object_store.v1 import container
|
||||
from openstack.tests.functional import base
|
||||
|
||||
|
||||
class TestContainer(base.BaseFunctionalTest):
|
||||
|
||||
NAME = uuid.uuid4().hex
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super(TestContainer, cls).setUpClass()
|
||||
tainer = cls.conn.object_store.create_container(name=cls.NAME)
|
||||
assert isinstance(tainer, container.Container)
|
||||
cls.assertIs(cls.NAME, tainer.name)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
pass
|
||||
# TODO(thowe): uncomment this when bug/1451211 fixed
|
||||
# tainer = cls.conn.object_store.delete_container(cls.NAME)
|
||||
# cls.assertIs(None, tainer)
|
||||
|
||||
def test_list(self):
|
||||
names = [o.name for o in self.conn.object_store.containers()]
|
||||
self.assertIn(self.NAME, names)
|
Loading…
Reference in New Issue
Block a user