Skip to content

Commit

Permalink
Basic object store container functional tests
Browse files Browse the repository at this point in the history
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
  • Loading branch information
TerryHowe committed May 13, 2015
1 parent d4360b9 commit fbfbd68
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .testr.conf
Expand Up @@ -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 changes: 12 additions & 4 deletions openstack/tests/functional/base.py
Expand Up @@ -16,16 +16,24 @@

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)
Empty file.
Empty file.
39 changes: 39 additions & 0 deletions openstack/tests/functional/object/v1/test_container.py
@@ -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)

0 comments on commit fbfbd68

Please sign in to comment.