Comply with new hacking requirements
With new hacking>=0.8.0,<0.9 requirements, some functions are now deprecated. assertEquals -> assertEqual assertNotEquals -> assertNotEqual Change-Id: I70287b0c8561a901069bddcf3007751c34a4e0b5
This commit is contained in:
parent
69d74dde12
commit
48ff408222
@ -58,7 +58,7 @@ class TestCache(testtools.TestCase):
|
||||
orig_path = '%s.orig' % path
|
||||
with open(path) as now:
|
||||
with open(orig_path) as then:
|
||||
self.assertNotEquals(now.read(), then.read())
|
||||
self.assertNotEqual(now.read(), then.read())
|
||||
|
||||
# Saves the current copy as .last
|
||||
cache.commit('foo')
|
||||
@ -84,4 +84,4 @@ class TestCache(testtools.TestCase):
|
||||
self.assertIn(path, list_list)
|
||||
|
||||
def test_commit_no_cache(self):
|
||||
self.assertEquals(None, cache.commit('neversaved'))
|
||||
self.assertEqual(None, cache.commit('neversaved'))
|
||||
|
@ -62,18 +62,18 @@ class FakeRequests(object):
|
||||
def get(self, url, params, headers):
|
||||
self._test.addDetail('url', test_content.text_content(url))
|
||||
url = urlparse.urlparse(url)
|
||||
self._test.assertEquals(self._expected_netloc, url.netloc)
|
||||
self._test.assertEquals('/v1/', url.path)
|
||||
self._test.assertEquals('application/json',
|
||||
headers['Content-Type'])
|
||||
self._test.assertEqual(self._expected_netloc, url.netloc)
|
||||
self._test.assertEqual('/v1/', url.path)
|
||||
self._test.assertEqual('application/json',
|
||||
headers['Content-Type'])
|
||||
self._test.assertIn('SignatureVersion', params)
|
||||
self._test.assertEquals('2', params['SignatureVersion'])
|
||||
self._test.assertEqual('2', params['SignatureVersion'])
|
||||
self._test.assertIn('Signature', params)
|
||||
self._test.assertIn('Action', params)
|
||||
self._test.assertEquals('DescribeStackResource',
|
||||
params['Action'])
|
||||
self._test.assertEqual('DescribeStackResource',
|
||||
params['Action'])
|
||||
self._test.assertIn('LogicalResourceId', params)
|
||||
self._test.assertEquals('foo', params['LogicalResourceId'])
|
||||
self._test.assertEqual('foo', params['LogicalResourceId'])
|
||||
root = etree.Element('DescribeStackResourceResponse')
|
||||
result = etree.SubElement(root, 'DescribeStackResourceResult')
|
||||
detail = etree.SubElement(result, 'StackResourceDetail')
|
||||
@ -113,9 +113,9 @@ class TestCfn(testtools.TestCase):
|
||||
|
||||
for k in ('int1', 'strfoo', 'map_ab'):
|
||||
self.assertIn(k, cfn_md)
|
||||
self.assertEquals(cfn_md[k], META_DATA[k])
|
||||
self.assertEqual(cfn_md[k], META_DATA[k])
|
||||
|
||||
self.assertEquals('', self.log.output)
|
||||
self.assertEqual('', self.log.output)
|
||||
|
||||
def test_collect_cfn_fail(self):
|
||||
cfn_collect = cfn.Collector(requests_impl=FakeFailRequests)
|
||||
@ -152,7 +152,7 @@ class TestCfn(testtools.TestCase):
|
||||
content = cfn_collect.collect()
|
||||
self.assertThat(content, matchers.IsInstance(dict))
|
||||
self.assertIn(u'b', content)
|
||||
self.assertEquals(u'banana', content[u'b'])
|
||||
self.assertEqual(u'banana', content[u'b'])
|
||||
|
||||
def test_collect_cfn_metadata_url_overrides_hint(self):
|
||||
cfg.CONF.cfn.metadata_url = 'http://127.0.1.1:8000/v1/'
|
||||
|
@ -99,7 +99,7 @@ class TestCollect(testtools.TestCase):
|
||||
config_list = json.loads(list_file.read())
|
||||
self.assertThat(config_list, matchers.IsInstance(list))
|
||||
env_config_list = proc_args['env']['OS_CONFIG_FILES'].split(':')
|
||||
self.assertEquals(env_config_list, config_list)
|
||||
self.assertEqual(env_config_list, config_list)
|
||||
keys_found = set()
|
||||
for path in env_config_list:
|
||||
self.assertTrue(os.path.exists(path))
|
||||
@ -198,7 +198,7 @@ class TestCollect(testtools.TestCase):
|
||||
fixtures.MonkeyPatch('sys.stdout', output.stream))
|
||||
self._call_main(fake_args)
|
||||
cache_dir = output.getDetails()['stdout'].as_text().strip()
|
||||
self.assertEquals(fake_cachedir.path, cache_dir)
|
||||
self.assertEqual(fake_cachedir.path, cache_dir)
|
||||
|
||||
def test_main_print_only(self):
|
||||
cache_dir = self.useFixture(fixtures.TempDir())
|
||||
@ -244,7 +244,7 @@ class TestCollect(testtools.TestCase):
|
||||
pass
|
||||
|
||||
def fake_sleep(sleep_time):
|
||||
self.assertEquals(10, sleep_time)
|
||||
self.assertEqual(10, sleep_time)
|
||||
raise ExpectedException
|
||||
|
||||
self.useFixture(fixtures.MonkeyPatch('time.sleep', fake_sleep))
|
||||
@ -315,7 +315,7 @@ class TestCollectAll(testtools.TestCase):
|
||||
expected_paths = [
|
||||
os.path.join(self.cache_dir.path, '%s.json' % collector)
|
||||
for collector in new_list]
|
||||
self.assertEquals(expected_paths, paths)
|
||||
self.assertEqual(expected_paths, paths)
|
||||
|
||||
def test_collect_all_nostore(self):
|
||||
(any_changed, content) = self._call_collect_all(store=False)
|
||||
@ -339,7 +339,7 @@ class TestConf(testtools.TestCase):
|
||||
|
||||
def test_setup_conf(self):
|
||||
collect.setup_conf()
|
||||
self.assertEquals('/var/run/os-collect-config', cfg.CONF.cachedir)
|
||||
self.assertEqual('/var/run/os-collect-config', cfg.CONF.cachedir)
|
||||
self.assertTrue(extras.safe_hasattr(cfg.CONF, 'ec2'))
|
||||
self.assertTrue(extras.safe_hasattr(cfg.CONF, 'cfn'))
|
||||
|
||||
@ -351,12 +351,12 @@ class TestHup(testtools.TestCase):
|
||||
self.log = self.useFixture(fixtures.FakeLogger())
|
||||
|
||||
def fake_closerange(low, high):
|
||||
self.assertEquals(3, low)
|
||||
self.assertEquals(255, high)
|
||||
self.assertEqual(3, low)
|
||||
self.assertEqual(255, high)
|
||||
|
||||
def fake_execv(path, args):
|
||||
self.assertEquals(sys.argv[0], path)
|
||||
self.assertEquals(sys.argv, args)
|
||||
self.assertEqual(sys.argv[0], path)
|
||||
self.assertEqual(sys.argv, args)
|
||||
|
||||
self.useFixture(fixtures.MonkeyPatch('os.execv', fake_execv))
|
||||
self.useFixture(fixtures.MonkeyPatch('os.closerange', fake_closerange))
|
||||
@ -387,18 +387,18 @@ class TestFileHash(testtools.TestCase):
|
||||
|
||||
def test_getfilehash_nofile(self):
|
||||
h = collect.getfilehash([])
|
||||
self.assertEquals(h, "d41d8cd98f00b204e9800998ecf8427e")
|
||||
self.assertEqual(h, "d41d8cd98f00b204e9800998ecf8427e")
|
||||
|
||||
def test_getfilehash_onefile(self):
|
||||
h = collect.getfilehash([self.file_1])
|
||||
self.assertEquals(h, "6f8db599de986fab7a21625b7916589c")
|
||||
self.assertEqual(h, "6f8db599de986fab7a21625b7916589c")
|
||||
|
||||
def test_getfilehash_twofiles(self):
|
||||
h = collect.getfilehash([self.file_1, self.file_2])
|
||||
self.assertEquals(h, "a8e1b2b743037b1ec17b5d4b49369872")
|
||||
self.assertEqual(h, "a8e1b2b743037b1ec17b5d4b49369872")
|
||||
|
||||
def test_getfilehash_filenotfound(self):
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
collect.getfilehash([self.file_1, self.file_2]),
|
||||
collect.getfilehash([self.file_1, "/i/dont/exist", self.file_2])
|
||||
)
|
||||
|
@ -96,15 +96,15 @@ class TestEc2(testtools.TestCase):
|
||||
|
||||
for k in ('public-ipv4', 'instance-id', 'hostname'):
|
||||
self.assertIn(k, ec2_md)
|
||||
self.assertEquals(ec2_md[k], META_DATA[k])
|
||||
self.assertEqual(ec2_md[k], META_DATA[k])
|
||||
|
||||
self.assertEquals(ec2_md['block-device-mapping']['ami'], 'vda')
|
||||
self.assertEqual(ec2_md['block-device-mapping']['ami'], 'vda')
|
||||
|
||||
# SSH keys are special cases
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
{'0': {'openssh-key': 'ssh-rsa AAAAAAAAABBBBBBBBCCCCCCCC'}},
|
||||
ec2_md['public-keys'])
|
||||
self.assertEquals('', self.log.output)
|
||||
self.assertEqual('', self.log.output)
|
||||
|
||||
def test_collect_ec2_fail(self):
|
||||
collect.setup_conf()
|
||||
|
@ -60,9 +60,9 @@ class TestHeatLocal(testtools.TestCase):
|
||||
|
||||
for k in ('localstrA', 'localint9', 'localmap_xy'):
|
||||
self.assertIn(k, local_md)
|
||||
self.assertEquals(local_md[k], META_DATA[k])
|
||||
self.assertEqual(local_md[k], META_DATA[k])
|
||||
|
||||
self.assertEquals('', self.log.output)
|
||||
self.assertEqual('', self.log.output)
|
||||
|
||||
def test_collect_ec2_nofile(self):
|
||||
tdir = self.useFixture(fixtures.TempDir())
|
||||
|
Loading…
Reference in New Issue
Block a user