test/(functional, probe): Replace "self.assert_" by "self.assertTrue"

The assert_() method is deprecated and can be safely replaced by assertTrue().
This patch makes sure that running the tests does not generate warnings
all over the screen.

Change-Id: I74705c6498249337bfdf955d62e0ad972035bc1f
This commit is contained in:
janonymous 2015-07-21 18:06:32 +05:30 committed by Alistair Coles
parent f244caf794
commit 8fe8bee7e0
8 changed files with 308 additions and 294 deletions

View File

@ -89,22 +89,22 @@ class TestAccount(unittest.TestCase):
self.assertEqual(resp.status, 204) self.assertEqual(resp.status, 204)
resp = retry(head) resp = retry(head)
resp.read() resp.read()
self.assert_(resp.status in (200, 204), resp.status) self.assertTrue(resp.status in (200, 204), resp.status)
self.assertEqual(resp.getheader('x-account-meta-test'), None) self.assertEqual(resp.getheader('x-account-meta-test'), None)
resp = retry(get) resp = retry(get)
resp.read() resp.read()
self.assert_(resp.status in (200, 204), resp.status) self.assertTrue(resp.status in (200, 204), resp.status)
self.assertEqual(resp.getheader('x-account-meta-test'), None) self.assertEqual(resp.getheader('x-account-meta-test'), None)
resp = retry(post, 'Value') resp = retry(post, 'Value')
resp.read() resp.read()
self.assertEqual(resp.status, 204) self.assertEqual(resp.status, 204)
resp = retry(head) resp = retry(head)
resp.read() resp.read()
self.assert_(resp.status in (200, 204), resp.status) self.assertTrue(resp.status in (200, 204), resp.status)
self.assertEqual(resp.getheader('x-account-meta-test'), 'Value') self.assertEqual(resp.getheader('x-account-meta-test'), 'Value')
resp = retry(get) resp = retry(get)
resp.read() resp.read()
self.assert_(resp.status in (200, 204), resp.status) self.assertTrue(resp.status in (200, 204), resp.status)
self.assertEqual(resp.getheader('x-account-meta-test'), 'Value') self.assertEqual(resp.getheader('x-account-meta-test'), 'Value')
def test_invalid_acls(self): def test_invalid_acls(self):
@ -204,7 +204,7 @@ class TestAccount(unittest.TestCase):
# read-only can read account headers # read-only can read account headers
resp = retry(get, use_account=3) resp = retry(get, use_account=3)
resp.read() resp.read()
self.assert_(resp.status in (200, 204)) self.assertTrue(resp.status in (200, 204))
# but not acls # but not acls
self.assertEqual(resp.getheader('X-Account-Access-Control'), None) self.assertEqual(resp.getheader('X-Account-Access-Control'), None)
@ -221,7 +221,7 @@ class TestAccount(unittest.TestCase):
self.assertEqual(resp.status, 204) self.assertEqual(resp.status, 204)
resp = retry(get, use_account=3) resp = retry(get, use_account=3)
resp.read() resp.read()
self.assert_(resp.status in (200, 204)) self.assertTrue(resp.status in (200, 204))
self.assertEqual(resp.getheader('X-Account-Meta-Test'), 'value') self.assertEqual(resp.getheader('X-Account-Meta-Test'), 'value')
@requires_acls @requires_acls
@ -255,7 +255,7 @@ class TestAccount(unittest.TestCase):
# read-write can read account headers # read-write can read account headers
resp = retry(get, use_account=3) resp = retry(get, use_account=3)
resp.read() resp.read()
self.assert_(resp.status in (200, 204)) self.assertTrue(resp.status in (200, 204))
# but not acls # but not acls
self.assertEqual(resp.getheader('X-Account-Access-Control'), None) self.assertEqual(resp.getheader('X-Account-Access-Control'), None)
@ -296,7 +296,7 @@ class TestAccount(unittest.TestCase):
# admin can read account headers # admin can read account headers
resp = retry(get, use_account=3) resp = retry(get, use_account=3)
resp.read() resp.read()
self.assert_(resp.status in (200, 204)) self.assertTrue(resp.status in (200, 204))
# including acls # including acls
self.assertEqual(resp.getheader('X-Account-Access-Control'), self.assertEqual(resp.getheader('X-Account-Access-Control'),
acl_json_str) acl_json_str)
@ -309,7 +309,7 @@ class TestAccount(unittest.TestCase):
self.assertEqual(resp.status, 204) self.assertEqual(resp.status, 204)
resp = retry(get, use_account=3) resp = retry(get, use_account=3)
resp.read() resp.read()
self.assert_(resp.status in (200, 204)) self.assertTrue(resp.status in (200, 204))
self.assertEqual(resp.getheader('X-Account-Meta-Test'), value) self.assertEqual(resp.getheader('X-Account-Meta-Test'), value)
# admin can even revoke their own access # admin can even revoke their own access
@ -359,8 +359,9 @@ class TestAccount(unittest.TestCase):
# read-only tester3 can read account metadata # read-only tester3 can read account metadata
resp = retry(get, use_account=3) resp = retry(get, use_account=3)
resp.read() resp.read()
self.assert_(resp.status in (200, 204), self.assertTrue(
'Expected status in (200, 204), got %s' % resp.status) resp.status in (200, 204),
'Expected status in (200, 204), got %s' % resp.status)
self.assertEqual(resp.getheader('X-Account-Meta-Test'), value) self.assertEqual(resp.getheader('X-Account-Meta-Test'), value)
# but not temp-url-key # but not temp-url-key
self.assertEqual(resp.getheader('X-Account-Meta-Temp-Url-Key'), None) self.assertEqual(resp.getheader('X-Account-Meta-Temp-Url-Key'), None)
@ -377,8 +378,9 @@ class TestAccount(unittest.TestCase):
# read-write tester3 can read account metadata # read-write tester3 can read account metadata
resp = retry(get, use_account=3) resp = retry(get, use_account=3)
resp.read() resp.read()
self.assert_(resp.status in (200, 204), self.assertTrue(
'Expected status in (200, 204), got %s' % resp.status) resp.status in (200, 204),
'Expected status in (200, 204), got %s' % resp.status)
self.assertEqual(resp.getheader('X-Account-Meta-Test'), value) self.assertEqual(resp.getheader('X-Account-Meta-Test'), value)
# but not temp-url-key # but not temp-url-key
self.assertEqual(resp.getheader('X-Account-Meta-Temp-Url-Key'), None) self.assertEqual(resp.getheader('X-Account-Meta-Temp-Url-Key'), None)
@ -395,8 +397,9 @@ class TestAccount(unittest.TestCase):
# admin tester3 can read account metadata # admin tester3 can read account metadata
resp = retry(get, use_account=3) resp = retry(get, use_account=3)
resp.read() resp.read()
self.assert_(resp.status in (200, 204), self.assertTrue(
'Expected status in (200, 204), got %s' % resp.status) resp.status in (200, 204),
'Expected status in (200, 204), got %s' % resp.status)
self.assertEqual(resp.getheader('X-Account-Meta-Test'), value) self.assertEqual(resp.getheader('X-Account-Meta-Test'), value)
# including temp-url-key # including temp-url-key
self.assertEqual(resp.getheader('X-Account-Meta-Temp-Url-Key'), self.assertEqual(resp.getheader('X-Account-Meta-Temp-Url-Key'),
@ -412,8 +415,9 @@ class TestAccount(unittest.TestCase):
self.assertEqual(resp.status, 204) self.assertEqual(resp.status, 204)
resp = retry(get, use_account=3) resp = retry(get, use_account=3)
resp.read() resp.read()
self.assert_(resp.status in (200, 204), self.assertTrue(
'Expected status in (200, 204), got %s' % resp.status) resp.status in (200, 204),
'Expected status in (200, 204), got %s' % resp.status)
self.assertEqual(resp.getheader('X-Account-Meta-Temp-Url-Key'), self.assertEqual(resp.getheader('X-Account-Meta-Temp-Url-Key'),
secret) secret)
@ -692,14 +696,14 @@ class TestAccount(unittest.TestCase):
self.assertTrue(resp.status in (201, 204)) self.assertTrue(resp.status in (201, 204))
resp = retry(head) resp = retry(head)
resp.read() resp.read()
self.assert_(resp.status in (200, 204), resp.status) self.assertTrue(resp.status in (200, 204), resp.status)
self.assertEqual(resp.getheader(uni_key.encode('utf-8')), '1') self.assertEqual(resp.getheader(uni_key.encode('utf-8')), '1')
resp = retry(post, 'X-Account-Meta-uni', uni_value) resp = retry(post, 'X-Account-Meta-uni', uni_value)
resp.read() resp.read()
self.assertEqual(resp.status, 204) self.assertEqual(resp.status, 204)
resp = retry(head) resp = retry(head)
resp.read() resp.read()
self.assert_(resp.status in (200, 204), resp.status) self.assertTrue(resp.status in (200, 204), resp.status)
self.assertEqual(resp.getheader('X-Account-Meta-uni'), self.assertEqual(resp.getheader('X-Account-Meta-uni'),
uni_value.encode('utf-8')) uni_value.encode('utf-8'))
if (tf.web_front_end == 'integral'): if (tf.web_front_end == 'integral'):
@ -708,7 +712,7 @@ class TestAccount(unittest.TestCase):
self.assertEqual(resp.status, 204) self.assertEqual(resp.status, 204)
resp = retry(head) resp = retry(head)
resp.read() resp.read()
self.assert_(resp.status in (200, 204), resp.status) self.assertTrue(resp.status in (200, 204), resp.status)
self.assertEqual(resp.getheader(uni_key.encode('utf-8')), self.assertEqual(resp.getheader(uni_key.encode('utf-8')),
uni_value.encode('utf-8')) uni_value.encode('utf-8'))
@ -730,14 +734,14 @@ class TestAccount(unittest.TestCase):
self.assertEqual(resp.status, 204) self.assertEqual(resp.status, 204)
resp = retry(head) resp = retry(head)
resp.read() resp.read()
self.assert_(resp.status in (200, 204), resp.status) self.assertTrue(resp.status in (200, 204), resp.status)
self.assertEqual(resp.getheader('x-account-meta-one'), '1') self.assertEqual(resp.getheader('x-account-meta-one'), '1')
resp = retry(post, 'X-Account-Meta-Two', '2') resp = retry(post, 'X-Account-Meta-Two', '2')
resp.read() resp.read()
self.assertEqual(resp.status, 204) self.assertEqual(resp.status, 204)
resp = retry(head) resp = retry(head)
resp.read() resp.read()
self.assert_(resp.status in (200, 204), resp.status) self.assertTrue(resp.status in (200, 204), resp.status)
self.assertEqual(resp.getheader('x-account-meta-one'), '1') self.assertEqual(resp.getheader('x-account-meta-one'), '1')
self.assertEqual(resp.getheader('x-account-meta-two'), '2') self.assertEqual(resp.getheader('x-account-meta-two'), '2')

View File

@ -72,7 +72,7 @@ class TestContainer(unittest.TestCase):
body = resp.read() body = resp.read()
if resp.status == 404: if resp.status == 404:
break break
self.assert_(resp.status // 100 == 2, resp.status) self.assertTrue(resp.status // 100 == 2, resp.status)
objs = json.loads(body) objs = json.loads(body)
if not objs: if not objs:
break break
@ -93,7 +93,7 @@ class TestContainer(unittest.TestCase):
# container may have not been created # container may have not been created
resp = retry(delete, self.container) resp = retry(delete, self.container)
resp.read() resp.read()
self.assert_(resp.status in (204, 404)) self.assertTrue(resp.status in (204, 404))
def test_multi_metadata(self): def test_multi_metadata(self):
if tf.skip: if tf.skip:
@ -114,14 +114,14 @@ class TestContainer(unittest.TestCase):
self.assertEqual(resp.status, 204) self.assertEqual(resp.status, 204)
resp = retry(head) resp = retry(head)
resp.read() resp.read()
self.assert_(resp.status in (200, 204), resp.status) self.assertTrue(resp.status in (200, 204), resp.status)
self.assertEqual(resp.getheader('x-container-meta-one'), '1') self.assertEqual(resp.getheader('x-container-meta-one'), '1')
resp = retry(post, 'X-Container-Meta-Two', '2') resp = retry(post, 'X-Container-Meta-Two', '2')
resp.read() resp.read()
self.assertEqual(resp.status, 204) self.assertEqual(resp.status, 204)
resp = retry(head) resp = retry(head)
resp.read() resp.read()
self.assert_(resp.status in (200, 204), resp.status) self.assertTrue(resp.status in (200, 204), resp.status)
self.assertEqual(resp.getheader('x-container-meta-one'), '1') self.assertEqual(resp.getheader('x-container-meta-one'), '1')
self.assertEqual(resp.getheader('x-container-meta-two'), '2') self.assertEqual(resp.getheader('x-container-meta-two'), '2')
@ -147,14 +147,14 @@ class TestContainer(unittest.TestCase):
self.assertEqual(resp.status, 204) self.assertEqual(resp.status, 204)
resp = retry(head) resp = retry(head)
resp.read() resp.read()
self.assert_(resp.status in (200, 204), resp.status) self.assertTrue(resp.status in (200, 204), resp.status)
self.assertEqual(resp.getheader(uni_key.encode('utf-8')), '1') self.assertEqual(resp.getheader(uni_key.encode('utf-8')), '1')
resp = retry(post, 'X-Container-Meta-uni', uni_value) resp = retry(post, 'X-Container-Meta-uni', uni_value)
resp.read() resp.read()
self.assertEqual(resp.status, 204) self.assertEqual(resp.status, 204)
resp = retry(head) resp = retry(head)
resp.read() resp.read()
self.assert_(resp.status in (200, 204), resp.status) self.assertTrue(resp.status in (200, 204), resp.status)
self.assertEqual(resp.getheader('X-Container-Meta-uni'), self.assertEqual(resp.getheader('X-Container-Meta-uni'),
uni_value.encode('utf-8')) uni_value.encode('utf-8'))
if (tf.web_front_end == 'integral'): if (tf.web_front_end == 'integral'):
@ -163,7 +163,7 @@ class TestContainer(unittest.TestCase):
self.assertEqual(resp.status, 204) self.assertEqual(resp.status, 204)
resp = retry(head) resp = retry(head)
resp.read() resp.read()
self.assert_(resp.status in (200, 204), resp.status) self.assertTrue(resp.status in (200, 204), resp.status)
self.assertEqual(resp.getheader(uni_key.encode('utf-8')), self.assertEqual(resp.getheader(uni_key.encode('utf-8')),
uni_value.encode('utf-8')) uni_value.encode('utf-8'))
@ -198,11 +198,11 @@ class TestContainer(unittest.TestCase):
self.assertEqual(resp.status, 201) self.assertEqual(resp.status, 201)
resp = retry(head, name) resp = retry(head, name)
resp.read() resp.read()
self.assert_(resp.status in (200, 204), resp.status) self.assertTrue(resp.status in (200, 204), resp.status)
self.assertEqual(resp.getheader('x-container-meta-test'), 'Value') self.assertEqual(resp.getheader('x-container-meta-test'), 'Value')
resp = retry(get, name) resp = retry(get, name)
resp.read() resp.read()
self.assert_(resp.status in (200, 204), resp.status) self.assertTrue(resp.status in (200, 204), resp.status)
self.assertEqual(resp.getheader('x-container-meta-test'), 'Value') self.assertEqual(resp.getheader('x-container-meta-test'), 'Value')
resp = retry(delete, name) resp = retry(delete, name)
resp.read() resp.read()
@ -214,11 +214,11 @@ class TestContainer(unittest.TestCase):
self.assertEqual(resp.status, 201) self.assertEqual(resp.status, 201)
resp = retry(head, name) resp = retry(head, name)
resp.read() resp.read()
self.assert_(resp.status in (200, 204), resp.status) self.assertTrue(resp.status in (200, 204), resp.status)
self.assertEqual(resp.getheader('x-container-meta-test'), None) self.assertEqual(resp.getheader('x-container-meta-test'), None)
resp = retry(get, name) resp = retry(get, name)
resp.read() resp.read()
self.assert_(resp.status in (200, 204), resp.status) self.assertTrue(resp.status in (200, 204), resp.status)
self.assertEqual(resp.getheader('x-container-meta-test'), None) self.assertEqual(resp.getheader('x-container-meta-test'), None)
resp = retry(delete, name) resp = retry(delete, name)
resp.read() resp.read()
@ -246,22 +246,22 @@ class TestContainer(unittest.TestCase):
resp = retry(head) resp = retry(head)
resp.read() resp.read()
self.assert_(resp.status in (200, 204), resp.status) self.assertTrue(resp.status in (200, 204), resp.status)
self.assertEqual(resp.getheader('x-container-meta-test'), None) self.assertEqual(resp.getheader('x-container-meta-test'), None)
resp = retry(get) resp = retry(get)
resp.read() resp.read()
self.assert_(resp.status in (200, 204), resp.status) self.assertTrue(resp.status in (200, 204), resp.status)
self.assertEqual(resp.getheader('x-container-meta-test'), None) self.assertEqual(resp.getheader('x-container-meta-test'), None)
resp = retry(post, 'Value') resp = retry(post, 'Value')
resp.read() resp.read()
self.assertEqual(resp.status, 204) self.assertEqual(resp.status, 204)
resp = retry(head) resp = retry(head)
resp.read() resp.read()
self.assert_(resp.status in (200, 204), resp.status) self.assertTrue(resp.status in (200, 204), resp.status)
self.assertEqual(resp.getheader('x-container-meta-test'), 'Value') self.assertEqual(resp.getheader('x-container-meta-test'), 'Value')
resp = retry(get) resp = retry(get)
resp.read() resp.read()
self.assert_(resp.status in (200, 204), resp.status) self.assertTrue(resp.status in (200, 204), resp.status)
self.assertEqual(resp.getheader('x-container-meta-test'), 'Value') self.assertEqual(resp.getheader('x-container-meta-test'), 'Value')
def test_PUT_bad_metadata(self): def test_PUT_bad_metadata(self):
@ -484,7 +484,7 @@ class TestContainer(unittest.TestCase):
resp = retry(get) resp = retry(get)
raise Exception('Should not have been able to GET') raise Exception('Should not have been able to GET')
except Exception as err: except Exception as err:
self.assert_(str(err).startswith('No result after '), err) self.assertTrue(str(err).startswith('No result after '), err)
def post(url, token, parsed, conn): def post(url, token, parsed, conn):
conn.request('POST', parsed.path + '/' + self.name, '', conn.request('POST', parsed.path + '/' + self.name, '',
@ -511,7 +511,7 @@ class TestContainer(unittest.TestCase):
resp = retry(get) resp = retry(get)
raise Exception('Should not have been able to GET') raise Exception('Should not have been able to GET')
except Exception as err: except Exception as err:
self.assert_(str(err).startswith('No result after '), err) self.assertTrue(str(err).startswith('No result after '), err)
def test_cross_account_container(self): def test_cross_account_container(self):
if tf.skip or tf.skip2: if tf.skip or tf.skip2:
@ -743,7 +743,7 @@ class TestContainer(unittest.TestCase):
resp = retry(get, use_account=3) resp = retry(get, use_account=3)
listing = resp.read() listing = resp.read()
self.assertEquals(resp.status, 200) self.assertEquals(resp.status, 200)
self.assert_(self.name in listing) self.assertTrue(self.name in listing)
# read-only can not create containers # read-only can not create containers
new_container_name = str(uuid4()) new_container_name = str(uuid4())
@ -758,7 +758,7 @@ class TestContainer(unittest.TestCase):
resp = retry(get, use_account=3) resp = retry(get, use_account=3)
listing = resp.read() listing = resp.read()
self.assertEquals(resp.status, 200) self.assertEquals(resp.status, 200)
self.assert_(new_container_name in listing) self.assertTrue(new_container_name in listing)
@requires_acls @requires_acls
def test_read_only_acl_metadata(self): def test_read_only_acl_metadata(self):
@ -858,7 +858,7 @@ class TestContainer(unittest.TestCase):
resp = retry(get, use_account=3) resp = retry(get, use_account=3)
listing = resp.read() listing = resp.read()
self.assertEquals(resp.status, 200) self.assertEquals(resp.status, 200)
self.assert_(self.name in listing) self.assertTrue(self.name in listing)
# can create new containers # can create new containers
new_container_name = str(uuid4()) new_container_name = str(uuid4())
@ -868,7 +868,7 @@ class TestContainer(unittest.TestCase):
resp = retry(get, use_account=3) resp = retry(get, use_account=3)
listing = resp.read() listing = resp.read()
self.assertEquals(resp.status, 200) self.assertEquals(resp.status, 200)
self.assert_(new_container_name in listing) self.assertTrue(new_container_name in listing)
# can also delete them # can also delete them
resp = retry(delete, new_container_name, use_account=3) resp = retry(delete, new_container_name, use_account=3)
@ -877,7 +877,7 @@ class TestContainer(unittest.TestCase):
resp = retry(get, use_account=3) resp = retry(get, use_account=3)
listing = resp.read() listing = resp.read()
self.assertEquals(resp.status, 200) self.assertEquals(resp.status, 200)
self.assert_(new_container_name not in listing) self.assertTrue(new_container_name not in listing)
# even if they didn't create them # even if they didn't create them
empty_container_name = str(uuid4()) empty_container_name = str(uuid4())
@ -1000,7 +1000,7 @@ class TestContainer(unittest.TestCase):
resp = retry(get, use_account=3) resp = retry(get, use_account=3)
listing = resp.read() listing = resp.read()
self.assertEquals(resp.status, 200) self.assertEquals(resp.status, 200)
self.assert_(self.name in listing) self.assertTrue(self.name in listing)
# can create new containers # can create new containers
new_container_name = str(uuid4()) new_container_name = str(uuid4())
@ -1010,7 +1010,7 @@ class TestContainer(unittest.TestCase):
resp = retry(get, use_account=3) resp = retry(get, use_account=3)
listing = resp.read() listing = resp.read()
self.assertEquals(resp.status, 200) self.assertEquals(resp.status, 200)
self.assert_(new_container_name in listing) self.assertTrue(new_container_name in listing)
# can also delete them # can also delete them
resp = retry(delete, new_container_name, use_account=3) resp = retry(delete, new_container_name, use_account=3)
@ -1019,7 +1019,7 @@ class TestContainer(unittest.TestCase):
resp = retry(get, use_account=3) resp = retry(get, use_account=3)
listing = resp.read() listing = resp.read()
self.assertEquals(resp.status, 200) self.assertEquals(resp.status, 200)
self.assert_(new_container_name not in listing) self.assertTrue(new_container_name not in listing)
# even if they didn't create them # even if they didn't create them
empty_container_name = str(uuid4()) empty_container_name = str(uuid4())
@ -1595,7 +1595,7 @@ class BaseTestContainerACLs(unittest.TestCase):
while True: while True:
resp = retry(get, use_account=self.account) resp = retry(get, use_account=self.account)
body = resp.read() body = resp.read()
self.assert_(resp.status // 100 == 2, resp.status) self.assertTrue(resp.status // 100 == 2, resp.status)
objs = json.loads(body) objs = json.loads(body)
if not objs: if not objs:
break break

View File

@ -89,7 +89,7 @@ class TestObject(unittest.TestCase):
body = resp.read() body = resp.read()
if resp.status == 404: if resp.status == 404:
break break
self.assert_(resp.status // 100 == 2, resp.status) self.assertTrue(resp.status // 100 == 2, resp.status)
objs = json.loads(body) objs = json.loads(body)
if not objs: if not objs:
break break
@ -107,7 +107,7 @@ class TestObject(unittest.TestCase):
for container in self.containers: for container in self.containers:
resp = retry(delete, container) resp = retry(delete, container)
resp.read() resp.read()
self.assert_(resp.status in (204, 404)) self.assertTrue(resp.status in (204, 404))
def test_if_none_match(self): def test_if_none_match(self):
def put(url, token, parsed, conn): def put(url, token, parsed, conn):
@ -387,7 +387,7 @@ class TestObject(unittest.TestCase):
resp = retry(get) resp = retry(get)
raise Exception('Should not have been able to GET') raise Exception('Should not have been able to GET')
except Exception as err: except Exception as err:
self.assert_(str(err).startswith('No result after ')) self.assertTrue(str(err).startswith('No result after '))
def post(url, token, parsed, conn): def post(url, token, parsed, conn):
conn.request('POST', parsed.path + '/' + self.container, '', conn.request('POST', parsed.path + '/' + self.container, '',
@ -412,7 +412,7 @@ class TestObject(unittest.TestCase):
resp = retry(get) resp = retry(get)
raise Exception('Should not have been able to GET') raise Exception('Should not have been able to GET')
except Exception as err: except Exception as err:
self.assert_(str(err).startswith('No result after ')) self.assertTrue(str(err).startswith('No result after '))
def test_private_object(self): def test_private_object(self):
if tf.skip or tf.skip3: if tf.skip or tf.skip3:
@ -562,7 +562,7 @@ class TestObject(unittest.TestCase):
resp = retry(get_listing, use_account=3) resp = retry(get_listing, use_account=3)
listing = resp.read() listing = resp.read()
self.assertEquals(resp.status, 200) self.assertEquals(resp.status, 200)
self.assert_(self.obj in listing) self.assertTrue(self.obj in listing)
# can get object # can get object
resp = retry(get, self.obj, use_account=3) resp = retry(get, self.obj, use_account=3)
@ -585,8 +585,8 @@ class TestObject(unittest.TestCase):
resp = retry(get_listing, use_account=3) resp = retry(get_listing, use_account=3)
listing = resp.read() listing = resp.read()
self.assertEquals(resp.status, 200) self.assertEquals(resp.status, 200)
self.assert_(obj_name not in listing) self.assertTrue(obj_name not in listing)
self.assert_(self.obj in listing) self.assertTrue(self.obj in listing)
@requires_acls @requires_acls
def test_read_write(self): def test_read_write(self):
@ -643,7 +643,7 @@ class TestObject(unittest.TestCase):
resp = retry(get_listing, use_account=3) resp = retry(get_listing, use_account=3)
listing = resp.read() listing = resp.read()
self.assertEquals(resp.status, 200) self.assertEquals(resp.status, 200)
self.assert_(self.obj in listing) self.assertTrue(self.obj in listing)
# can get object # can get object
resp = retry(get, self.obj, use_account=3) resp = retry(get, self.obj, use_account=3)
@ -666,8 +666,8 @@ class TestObject(unittest.TestCase):
resp = retry(get_listing, use_account=3) resp = retry(get_listing, use_account=3)
listing = resp.read() listing = resp.read()
self.assertEquals(resp.status, 200) self.assertEquals(resp.status, 200)
self.assert_(obj_name in listing) self.assertTrue(obj_name in listing)
self.assert_(self.obj not in listing) self.assertTrue(self.obj not in listing)
@requires_acls @requires_acls
def test_admin(self): def test_admin(self):
@ -724,7 +724,7 @@ class TestObject(unittest.TestCase):
resp = retry(get_listing, use_account=3) resp = retry(get_listing, use_account=3)
listing = resp.read() listing = resp.read()
self.assertEquals(resp.status, 200) self.assertEquals(resp.status, 200)
self.assert_(self.obj in listing) self.assertTrue(self.obj in listing)
# can get object # can get object
resp = retry(get, self.obj, use_account=3) resp = retry(get, self.obj, use_account=3)
@ -747,8 +747,8 @@ class TestObject(unittest.TestCase):
resp = retry(get_listing, use_account=3) resp = retry(get_listing, use_account=3)
listing = resp.read() listing = resp.read()
self.assertEquals(resp.status, 200) self.assertEquals(resp.status, 200)
self.assert_(obj_name in listing) self.assertTrue(obj_name in listing)
self.assert_(self.obj not in listing) self.assertTrue(self.obj not in listing)
def test_manifest(self): def test_manifest(self):
if tf.skip: if tf.skip:

File diff suppressed because it is too large Load Diff

View File

@ -49,8 +49,8 @@ class TestAccountFailures(ReplProbeTest):
found2 = True found2 = True
self.assertEquals(container['count'], 0) self.assertEquals(container['count'], 0)
self.assertEquals(container['bytes'], 0) self.assertEquals(container['bytes'], 0)
self.assert_(found1) self.assertTrue(found1)
self.assert_(found2) self.assertTrue(found2)
# Create container2/object1 # Create container2/object1
client.put_object(self.url, self.token, container2, 'object1', '1234') client.put_object(self.url, self.token, container2, 'object1', '1234')
@ -71,8 +71,8 @@ class TestAccountFailures(ReplProbeTest):
found2 = True found2 = True
self.assertEquals(container['count'], 0) self.assertEquals(container['count'], 0)
self.assertEquals(container['bytes'], 0) self.assertEquals(container['bytes'], 0)
self.assert_(found1) self.assertTrue(found1)
self.assert_(found2) self.assertTrue(found2)
# Get to final state # Get to final state
self.get_to_final_state() self.get_to_final_state()
@ -93,8 +93,8 @@ class TestAccountFailures(ReplProbeTest):
found2 = True found2 = True
self.assertEquals(container['count'], 1) self.assertEquals(container['count'], 1)
self.assertEquals(container['bytes'], 4) self.assertEquals(container['bytes'], 4)
self.assert_(found1) self.assertTrue(found1)
self.assert_(found2) self.assertTrue(found2)
apart, anodes = self.account_ring.get_nodes(self.account) apart, anodes = self.account_ring.get_nodes(self.account)
kill_nonprimary_server(anodes, self.ipport2server, self.pids) kill_nonprimary_server(anodes, self.ipport2server, self.pids)
@ -123,8 +123,8 @@ class TestAccountFailures(ReplProbeTest):
found2 = True found2 = True
self.assertEquals(container['count'], 1) self.assertEquals(container['count'], 1)
self.assertEquals(container['bytes'], 4) self.assertEquals(container['bytes'], 4)
self.assert_(not found1) self.assertTrue(not found1)
self.assert_(found2) self.assertTrue(found2)
# Run container updaters # Run container updaters
Manager(['container-updater']).once() Manager(['container-updater']).once()
@ -143,8 +143,8 @@ class TestAccountFailures(ReplProbeTest):
found2 = True found2 = True
self.assertEquals(container['count'], 2) self.assertEquals(container['count'], 2)
self.assertEquals(container['bytes'], 9) self.assertEquals(container['bytes'], 9)
self.assert_(not found1) self.assertTrue(not found1)
self.assert_(found2) self.assertTrue(found2)
# Restart other primary account server # Restart other primary account server
start_server((anodes[0]['ip'], anodes[0]['port']), start_server((anodes[0]['ip'], anodes[0]['port']),
@ -166,8 +166,8 @@ class TestAccountFailures(ReplProbeTest):
found2 = True found2 = True
self.assertEquals(container['count'], 1) self.assertEquals(container['count'], 1)
self.assertEquals(container['bytes'], 4) self.assertEquals(container['bytes'], 4)
self.assert_(found1) self.assertTrue(found1)
self.assert_(found2) self.assertTrue(found2)
# Get to final state # Get to final state
self.get_to_final_state() self.get_to_final_state()
@ -187,8 +187,8 @@ class TestAccountFailures(ReplProbeTest):
found2 = True found2 = True
self.assertEquals(container['count'], 2) self.assertEquals(container['count'], 2)
self.assertEquals(container['bytes'], 9) self.assertEquals(container['bytes'], 9)
self.assert_(not found1) self.assertTrue(not found1)
self.assert_(found2) self.assertTrue(found2)
if __name__ == '__main__': if __name__ == '__main__':

View File

@ -65,9 +65,10 @@ class TestContainerMergePolicyIndex(ReplProbeTest):
found_policy_indexes = \ found_policy_indexes = \
set(metadata['X-Backend-Storage-Policy-Index'] for set(metadata['X-Backend-Storage-Policy-Index'] for
node, metadata in head_responses) node, metadata in head_responses)
self.assert_(len(found_policy_indexes) > 1, self.assertTrue(
'primary nodes did not disagree about policy index %r' % len(found_policy_indexes) > 1,
head_responses) 'primary nodes did not disagree about policy index %r' %
head_responses)
# find our object # find our object
orig_policy_index = None orig_policy_index = None
for policy_index in found_policy_indexes: for policy_index in found_policy_indexes:
@ -102,9 +103,9 @@ class TestContainerMergePolicyIndex(ReplProbeTest):
found_policy_indexes = \ found_policy_indexes = \
set(metadata['X-Backend-Storage-Policy-Index'] for set(metadata['X-Backend-Storage-Policy-Index'] for
node, metadata in head_responses) node, metadata in head_responses)
self.assert_(len(found_policy_indexes) == 1, self.assertTrue(len(found_policy_indexes) == 1,
'primary nodes disagree about policy index %r' % 'primary nodes disagree about policy index %r' %
head_responses) head_responses)
expected_policy_index = found_policy_indexes.pop() expected_policy_index = found_policy_indexes.pop()
self.assertNotEqual(orig_policy_index, expected_policy_index) self.assertNotEqual(orig_policy_index, expected_policy_index)
@ -165,9 +166,10 @@ class TestContainerMergePolicyIndex(ReplProbeTest):
found_policy_indexes = \ found_policy_indexes = \
set(metadata['X-Backend-Storage-Policy-Index'] for set(metadata['X-Backend-Storage-Policy-Index'] for
node, metadata in head_responses) node, metadata in head_responses)
self.assert_(len(found_policy_indexes) > 1, self.assertTrue(
'primary nodes did not disagree about policy index %r' % len(found_policy_indexes) > 1,
head_responses) 'primary nodes did not disagree about policy index %r' %
head_responses)
# find our object # find our object
orig_policy_index = ts_policy_index = None orig_policy_index = ts_policy_index = None
for policy_index in found_policy_indexes: for policy_index in found_policy_indexes:
@ -207,11 +209,11 @@ class TestContainerMergePolicyIndex(ReplProbeTest):
new_found_policy_indexes = \ new_found_policy_indexes = \
set(metadata['X-Backend-Storage-Policy-Index'] for node, set(metadata['X-Backend-Storage-Policy-Index'] for node,
metadata in head_responses) metadata in head_responses)
self.assert_(len(new_found_policy_indexes) == 1, self.assertTrue(len(new_found_policy_indexes) == 1,
'primary nodes disagree about policy index %r' % 'primary nodes disagree about policy index %r' %
dict((node['port'], dict((node['port'],
metadata['X-Backend-Storage-Policy-Index']) metadata['X-Backend-Storage-Policy-Index'])
for node, metadata in head_responses)) for node, metadata in head_responses))
expected_policy_index = new_found_policy_indexes.pop() expected_policy_index = new_found_policy_indexes.pop()
self.assertEqual(orig_policy_index, expected_policy_index) self.assertEqual(orig_policy_index, expected_policy_index)
# validate object fully deleted # validate object fully deleted

View File

@ -54,7 +54,7 @@ class TestObjectAsyncUpdate(ReplProbeTest):
self.ipport2server, self.pids) self.ipport2server, self.pids)
# Assert it does not know about container/obj # Assert it does not know about container/obj
self.assert_(not direct_client.direct_get_container( self.assertTrue(not direct_client.direct_get_container(
cnode, cpart, self.account, container)[1]) cnode, cpart, self.account, container)[1])
# Run the object-updaters # Run the object-updaters
@ -63,7 +63,7 @@ class TestObjectAsyncUpdate(ReplProbeTest):
# Assert the other primary server now knows about container/obj # Assert the other primary server now knows about container/obj
objs = [o['name'] for o in direct_client.direct_get_container( objs = [o['name'] for o in direct_client.direct_get_container(
cnode, cpart, self.account, container)[1]] cnode, cpart, self.account, container)[1]]
self.assert_(obj in objs) self.assertTrue(obj in objs)
class TestUpdateOverrides(ReplProbeTest): class TestUpdateOverrides(ReplProbeTest):

View File

@ -87,7 +87,7 @@ class TestObjectExpirer(ReplProbeTest):
self.account, self.container_name, self.object_name, self.account, self.container_name, self.object_name,
acceptable_statuses=(4,), acceptable_statuses=(4,),
headers={'X-Backend-Storage-Policy-Index': int(old_policy)}) headers={'X-Backend-Storage-Policy-Index': int(old_policy)})
self.assert_('x-backend-timestamp' in metadata) self.assertTrue('x-backend-timestamp' in metadata)
self.assertEqual(Timestamp(metadata['x-backend-timestamp']), self.assertEqual(Timestamp(metadata['x-backend-timestamp']),
create_timestamp) create_timestamp)
@ -122,9 +122,9 @@ class TestObjectExpirer(ReplProbeTest):
self.fail('found object in %s and also %s' % self.fail('found object in %s and also %s' %
(found_in_policy, policy)) (found_in_policy, policy))
found_in_policy = policy found_in_policy = policy
self.assert_('x-backend-timestamp' in metadata) self.assertTrue('x-backend-timestamp' in metadata)
self.assert_(Timestamp(metadata['x-backend-timestamp']) > self.assertTrue(Timestamp(metadata['x-backend-timestamp']) >
create_timestamp) create_timestamp)
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() unittest.main()