Use testtools as the base testcase class.
Use testtools as the base unittest test case class towards to
parallelizing the test runs. Catch places where setUp and tearDown
were not being chained properly, and fix these problems.Remove
custom skip, using testtools.skip instead. Add TestResourceManager.
Part of blueprint speed-up-tempest
Change-Id: I8e7b5686b22969a0f3db96100a357c93a4d5c03f
diff --git a/tempest/tests/identity/admin/test_users.py b/tempest/tests/identity/admin/test_users.py
index 7ad932b..ef7d934 100644
--- a/tempest/tests/identity/admin/test_users.py
+++ b/tempest/tests/identity/admin/test_users.py
@@ -16,11 +16,11 @@
# under the License.
from nose.plugins.attrib import attr
-import unittest2 as unittest
-
from tempest.common.utils.data_utils import rand_name
from tempest import exceptions
from tempest.tests.identity import base
+import testtools
+from testtools.matchers._basic import Contains
class UsersTestBase(object):
@@ -76,7 +76,7 @@
self.data.tenant['id'], self.data.test_email)
@attr(type='negative')
- @unittest.skip("Until Bug 999084 is fixed")
+ @testtools.skip("Until Bug 999084 is fixed")
def test_create_user_with_empty_password(self):
# User with an empty password should not be created
self.data.setup_test_tenant()
@@ -85,7 +85,7 @@
self.alt_email)
@attr(type='nagative')
- @unittest.skip("Until Bug 999084 is fixed")
+ @testtools.skip("Until Bug 999084 is fixed")
def test_create_user_with_long_password(self):
# User having password exceeding max length should not be created
self.data.setup_test_tenant()
@@ -94,7 +94,7 @@
self.alt_email)
@attr(type='negative')
- @unittest.skip("Until Bug 999084 is fixed")
+ @testtools.skip("Until Bug 999084 is fixed")
def test_create_user_with_invalid_email_format(self):
# Email format should be validated while creating a user
self.data.setup_test_tenant()
@@ -227,8 +227,9 @@
# Get a list of users and find the test user
self.data.setup_test_user()
resp, users = self.client.get_users()
- self.assertIn(self.data.test_user, [u['name'] for u in users],
- "Could not find %s" % self.data.test_user)
+ self.assertThat([u['name'] for u in users],
+ Contains(self.data.test_user),
+ "Could not find %s" % self.data.test_user)
@attr(type='negative')
def test_get_users_by_unauthorized_user(self):