Replace decprecated method aliases in tests
Some of the TestCase methods have been deprecated since python 2.7. We need use correct names. http://docs.python.org/2/library/unittest.html#deprecated-aliases * replace 'failIf' with 'assertFalse' * replace 'failUnlessAlmostEqual' with 'assertAlmostEqual' Change-Id: I68746f8810c17cd5456328005fc65003e57491c8
This commit is contained in:
parent
e012b3f4c3
commit
bec4d209e7
@ -546,7 +546,7 @@ class LimiterTest(BaseLimitTestSuite):
|
|||||||
|
|
||||||
expected = 60.0 / 7.0
|
expected = 60.0 / 7.0
|
||||||
results = self._check_sum(1, "POST", "/anything")
|
results = self._check_sum(1, "POST", "/anything")
|
||||||
self.failUnlessAlmostEqual(expected, results, 8)
|
self.assertAlmostEqual(expected, results, 8)
|
||||||
|
|
||||||
def test_delay_GET(self):
|
def test_delay_GET(self):
|
||||||
# Ensure the 11th GET will result in NO delay.
|
# Ensure the 11th GET will result in NO delay.
|
||||||
|
@ -551,7 +551,7 @@ class LimiterTest(BaseLimitTestSuite):
|
|||||||
|
|
||||||
expected = 60.0 / 7.0
|
expected = 60.0 / 7.0
|
||||||
results = self._check_sum(1, "POST", "/anything")
|
results = self._check_sum(1, "POST", "/anything")
|
||||||
self.failUnlessAlmostEqual(expected, results, 8)
|
self.assertAlmostEqual(expected, results, 8)
|
||||||
|
|
||||||
def test_delay_GET(self):
|
def test_delay_GET(self):
|
||||||
# Ensure the 11th GET will result in NO delay.
|
# Ensure the 11th GET will result in NO delay.
|
||||||
|
@ -82,11 +82,11 @@ class InstanceTestsFromPublic(base.UserSmokeTestCase):
|
|||||||
else:
|
else:
|
||||||
self.fail('instance failed to start')
|
self.fail('instance failed to start')
|
||||||
ip = reservations[0].instances[0].private_ip_address
|
ip = reservations[0].instances[0].private_ip_address
|
||||||
self.failIf(ip == '0.0.0.0')
|
self.assertFalse(ip == '0.0.0.0')
|
||||||
self.data['private_ip'] = ip
|
self.data['private_ip'] = ip
|
||||||
if FLAGS.use_ipv6:
|
if FLAGS.use_ipv6:
|
||||||
ipv6 = reservations[0].instances[0].dns_name_v6
|
ipv6 = reservations[0].instances[0].dns_name_v6
|
||||||
self.failIf(ipv6 is None)
|
self.assertFalse(ipv6 is None)
|
||||||
self.data['ip_v6'] = ipv6
|
self.data['ip_v6'] = ipv6
|
||||||
|
|
||||||
def test_004_can_ssh_to_ipv6(self):
|
def test_004_can_ssh_to_ipv6(self):
|
||||||
@ -124,11 +124,11 @@ class InstanceTestsFromPublic(base.UserSmokeTestCase):
|
|||||||
else:
|
else:
|
||||||
self.fail('instance failed to start')
|
self.fail('instance failed to start')
|
||||||
ip = reservations[0].instances[0].private_ip_address
|
ip = reservations[0].instances[0].private_ip_address
|
||||||
self.failIf(ip == '0.0.0.0')
|
self.assertFalse(ip == '0.0.0.0')
|
||||||
self.data['private_ip'] = ip
|
self.data['private_ip'] = ip
|
||||||
if FLAGS.use_ipv6:
|
if FLAGS.use_ipv6:
|
||||||
ipv6 = reservations[0].instances[0].dns_name_v6
|
ipv6 = reservations[0].instances[0].dns_name_v6
|
||||||
self.failIf(ipv6 is None)
|
self.assertFalse(ipv6 is None)
|
||||||
self.data['ip_v6'] = ipv6
|
self.data['ip_v6'] = ipv6
|
||||||
|
|
||||||
def test_014_can_not_ping_private_ip(self):
|
def test_014_can_not_ping_private_ip(self):
|
||||||
|
@ -166,10 +166,10 @@ class InstanceTests(base.UserSmokeTestCase):
|
|||||||
self.fail('instance failed to start')
|
self.fail('instance failed to start')
|
||||||
self.data['instance'].update()
|
self.data['instance'].update()
|
||||||
ip = self.data['instance'].private_ip_address
|
ip = self.data['instance'].private_ip_address
|
||||||
self.failIf(ip == '0.0.0.0')
|
self.assertFalse(ip == '0.0.0.0')
|
||||||
if FLAGS.use_ipv6:
|
if FLAGS.use_ipv6:
|
||||||
ipv6 = self.data['instance'].dns_name_v6
|
ipv6 = self.data['instance'].dns_name_v6
|
||||||
self.failIf(ipv6 is None)
|
self.assertFalse(ipv6 is None)
|
||||||
|
|
||||||
def test_004_can_ping_private_ip(self):
|
def test_004_can_ping_private_ip(self):
|
||||||
if not self.wait_for_ping(self.data['instance'].private_ip_address):
|
if not self.wait_for_ping(self.data['instance'].private_ip_address):
|
||||||
|
Loading…
Reference in New Issue
Block a user