Commit ed0ae681 authored by Thomas Gambier's avatar Thomas Gambier 🚴🏼

CLENUP: use assertEqual instead of assertEquals

assertEquals is deprecated, see https://docs.python.org/2.7/library/unittest.html#deprecated-aliases
parent e1281991
...@@ -119,13 +119,13 @@ echo "htpasswd $@" > %s/monitor-htpasswd ...@@ -119,13 +119,13 @@ echo "htpasswd $@" > %s/monitor-htpasswd
command = 'htpasswd -cb %s admin %s%s' % (http_passwd, config["value"], '\n') command = 'htpasswd -cb %s admin %s%s' % (http_passwd, config["value"], '\n')
self.assertTrue(os.path.exists(parameter['file'])) self.assertTrue(os.path.exists(parameter['file']))
self.assertTrue(os.path.exists(http_passwd)) self.assertTrue(os.path.exists(http_passwd))
self.assertEquals(config["value"], open(parameter['file']).read()) self.assertEqual(config["value"], open(parameter['file']).read())
self.assertEquals(open(http_passwd).read(), command) self.assertEqual(open(http_passwd).read(), command)
elif config["key"] == 'cors-domain': elif config["key"] == 'cors-domain':
cors_file = "%s/test-httpd-cors.cfg" % self.base_dir cors_file = "%s/test-httpd-cors.cfg" % self.base_dir
self.assertTrue(os.path.exists(cors_file)) self.assertTrue(os.path.exists(cors_file))
cors_string = self.generate_cors_string(config["value"].split()) cors_string = self.generate_cors_string(config["value"].split())
self.assertEquals(cors_string, open(cors_file).read()) self.assertEqual(cors_string, open(cors_file).read())
def check_cfg_config(self, config_list): def check_cfg_config(self, config_list):
cfg_output = os.path.join(self.config_dir, 'config.cfg') cfg_output = os.path.join(self.config_dir, 'config.cfg')
...@@ -150,7 +150,7 @@ echo "htpasswd $@" > %s/monitor-htpasswd ...@@ -150,7 +150,7 @@ echo "htpasswd $@" > %s/monitor-htpasswd
result = instance.applyConfigChanges() result = instance.applyConfigChanges()
self.assertTrue(os.path.exists(cfg_output)) self.assertTrue(os.path.exists(cfg_output))
# Check result of non raw parameter edition # Check result of non raw parameter edition
self.assertEquals(result, {'cors-domain': True, 'from-file': True, 'httpd-password': True}) self.assertEqual(result, {'cors-domain': True, 'from-file': True, 'httpd-password': True})
self.check_config() self.check_config()
self.check_cfg_config(self.config) self.check_cfg_config(self.config)
...@@ -172,7 +172,7 @@ echo "htpasswd $@" > %s/monitor-htpasswd ...@@ -172,7 +172,7 @@ echo "htpasswd $@" > %s/monitor-htpasswd
result = instance.applyConfigChanges() result = instance.applyConfigChanges()
self.assertTrue(os.path.exists(cfg_output)) self.assertTrue(os.path.exists(cfg_output))
# Check result of non raw parameter edition # Check result of non raw parameter edition
self.assertEquals(result, {'from-file': True, 'httpd-password': True}) self.assertEqual(result, {'from-file': True, 'httpd-password': True})
self.check_config() self.check_config()
self.check_cfg_config(self.config) self.check_cfg_config(self.config)
...@@ -189,7 +189,7 @@ echo "htpasswd $@" > %s/monitor-htpasswd ...@@ -189,7 +189,7 @@ echo "htpasswd $@" > %s/monitor-htpasswd
result = instance.applyConfigChanges() result = instance.applyConfigChanges()
self.assertTrue(os.path.exists(cfg_output)) self.assertTrue(os.path.exists(cfg_output))
self.assertEquals(result, {'cors-domain': True, 'from-file': True, 'httpd-password': True}) self.assertEqual(result, {'cors-domain': True, 'from-file': True, 'httpd-password': True})
self.check_config() self.check_config()
self.check_cfg_config(self.config) self.check_cfg_config(self.config)
...@@ -199,7 +199,7 @@ echo "htpasswd $@" > %s/monitor-htpasswd ...@@ -199,7 +199,7 @@ echo "htpasswd $@" > %s/monitor-htpasswd
self.writeContent(self.config_path, json.dumps(self.config)) self.writeContent(self.config_path, json.dumps(self.config))
result = instance.applyConfigChanges() result = instance.applyConfigChanges()
self.assertEquals(result, {'cors-domain': True, 'from-file': True, 'httpd-password': True}) self.assertEqual(result, {'cors-domain': True, 'from-file': True, 'httpd-password': True})
self.check_config() self.check_config()
self.check_cfg_config(self.config) self.check_cfg_config(self.config)
...@@ -210,6 +210,6 @@ echo "htpasswd $@" > %s/monitor-htpasswd ...@@ -210,6 +210,6 @@ echo "htpasswd $@" > %s/monitor-htpasswd
self.writeContent(self.config_path, json.dumps(self.config)) self.writeContent(self.config_path, json.dumps(self.config))
result = instance.applyConfigChanges() result = instance.applyConfigChanges()
self.assertEquals(result, {'cors-domain': True, 'from-file': True, 'httpd-password': True}) self.assertEqual(result, {'cors-domain': True, 'from-file': True, 'httpd-password': True})
self.check_config() self.check_config()
self.check_cfg_config(self.config) self.check_cfg_config(self.config)
...@@ -51,28 +51,28 @@ class TestMonitorCollect(unittest.TestCase): ...@@ -51,28 +51,28 @@ class TestMonitorCollect(unittest.TestCase):
def test_getPartitionUsedMemoryAverage(self): def test_getPartitionUsedMemoryAverage(self):
self.assertEquals(1195.492578125, self.assertEqual(1195.492578125,
self.collector.getPartitionUsedMemoryAverage('slapuser15', '2017-09-16')) self.collector.getPartitionUsedMemoryAverage('slapuser15', '2017-09-16'))
def test_getPartitionCPULoadAverage(self): def test_getPartitionCPULoadAverage(self):
self.assertEquals(2.1599999999999993, self.assertEqual(2.1599999999999993,
self.collector.getPartitionCPULoadAverage('slapuser15', '2017-09-16')) self.collector.getPartitionCPULoadAverage('slapuser15', '2017-09-16'))
def test_getPartitionDiskUsedAverage(self): def test_getPartitionDiskUsedAverage(self):
self.assertEquals(35.5234375, self.assertEqual(35.5234375,
self.collector.getPartitionDiskUsedAverage('slapuser15', '2017-04-18')) self.collector.getPartitionDiskUsedAverage('slapuser15', '2017-04-18'))
def test_getPartitionConsumption(self): def test_getPartitionConsumption(self):
data = self.collector.getPartitionConsumption('slapuser15', date_scope='2017-09-16', data = self.collector.getPartitionConsumption('slapuser15', date_scope='2017-09-16',
min_time='00:01:00', max_time='00:13:00') min_time='00:01:00', max_time='00:13:00')
self.assertEquals(1302.66, data[0]['cpu_time']) self.assertEqual(1302.66, data[0]['cpu_time'])
self.assertEquals(26825304064.0, data[0]['io_rw_counter']) self.assertEqual(26825304064.0, data[0]['io_rw_counter'])
def test_getPartitionComsumptionStatus(self): def test_getPartitionComsumptionStatus(self):
data = self.collector.getPartitionComsumptionStatus('slapuser15', date_scope='2017-09-16', data = self.collector.getPartitionComsumptionStatus('slapuser15', date_scope='2017-09-16',
min_time='00:01:00', max_time='00:13:00') min_time='00:01:00', max_time='00:13:00')
self.assertEquals(7.3, data[0]['cpu_percent']) self.assertEqual(7.3, data[0]['cpu_percent'])
self.assertEquals(2822535483392.0, data[2]['io_rw_counter']) self.assertEqual(2822535483392.0, data[2]['io_rw_counter'])
def tearDown(self): def tearDown(self):
os.remove("/tmp/collector.db") os.remove("/tmp/collector.db")
......
...@@ -128,7 +128,7 @@ partition-folder = %(base_dir)s ...@@ -128,7 +128,7 @@ partition-folder = %(base_dir)s
destination += '/' destination += '/'
dest_file_list = os.listdir(destination) dest_file_list = os.listdir(destination)
source_file_list = os.listdir(source) source_file_list = os.listdir(source)
self.assertEquals(dest_file_list, source_file_list) self.assertEqual(dest_file_list, source_file_list)
def check_symlink(self, source, destination): def check_symlink(self, source, destination):
if source.endswith('/'): if source.endswith('/'):
...@@ -139,7 +139,7 @@ partition-folder = %(base_dir)s ...@@ -139,7 +139,7 @@ partition-folder = %(base_dir)s
source_basename = os.path.basename(source) source_basename = os.path.basename(source)
dest_basename = os.path.basename(destination) dest_basename = os.path.basename(destination)
self.assertEquals(source_basename, dest_basename) self.assertEqual(source_basename, dest_basename)
if os.path.isdir(source): if os.path.isdir(source):
self.check_folder_equals(source, destination) self.check_folder_equals(source, destination)
...@@ -251,32 +251,32 @@ partition-folder = %(base_dir)s ...@@ -251,32 +251,32 @@ partition-folder = %(base_dir)s
instance_config = os.path.join(instance.config_folder, '.jio_documents', 'config.json') instance_config = os.path.join(instance.config_folder, '.jio_documents', 'config.json')
self.assertTrue(os.path.exists(instance_config)) self.assertTrue(os.path.exists(instance_config))
config_content = json.loads(open(instance_config).read()) config_content = json.loads(open(instance_config).read())
self.assertEquals(len(config_content), 4) self.assertEqual(len(config_content), 4)
key_list = ['', 'sample', 'monitor-password', 'cors-domain'] key_list = ['', 'sample', 'monitor-password', 'cors-domain']
for parameter in config_content: for parameter in config_content:
if parameter['key'] in key_list: if parameter['key'] in key_list:
key_list.pop(key_list.index(parameter['key'])) key_list.pop(key_list.index(parameter['key']))
if parameter['key'] == '': if parameter['key'] == '':
self.assertEquals(parameter, dict( self.assertEqual(parameter, dict(
key="", key="",
title="monitor-user", title="monitor-user",
value="admin")) value="admin"))
if parameter['key'] == 'sample': if parameter['key'] == 'sample':
self.assertEquals(parameter, dict( self.assertEqual(parameter, dict(
key="sample", key="sample",
title="sample", title="sample",
value="12345")) value="12345"))
if parameter['key'] == 'monitor-password': if parameter['key'] == 'monitor-password':
self.assertEquals(parameter, dict( self.assertEqual(parameter, dict(
key="monitor-password", key="monitor-password",
title="monitor-password", title="monitor-password",
value="bcuandjy")) value="bcuandjy"))
if parameter['key'] == 'cors-domain': if parameter['key'] == 'cors-domain':
self.assertEquals(parameter, dict( self.assertEqual(parameter, dict(
key="cors-domain", key="cors-domain",
title="cors-domain", title="cors-domain",
value="")) value=""))
self.assertEquals(key_list, []) self.assertEqual(key_list, [])
...@@ -232,7 +232,7 @@ exit %(code)s ...@@ -232,7 +232,7 @@ exit %(code)s
with open(os.path.join(self.private_dir, 'monitor.global.json')) as r: with open(os.path.join(self.private_dir, 'monitor.global.json')) as r:
result = json.loads(r.read().decode("utf-8")) result = json.loads(r.read().decode("utf-8"))
result.pop("date") result.pop("date")
self.assertEquals(result, self.assertEqual(result,
json.loads(expected_result)) json.loads(expected_result))
# all promises are OK now # all promises are OK now
...@@ -251,7 +251,7 @@ exit %(code)s ...@@ -251,7 +251,7 @@ exit %(code)s
instance_result_dict = json.loads(r.read().decode("utf-8")) instance_result_dict = json.loads(r.read().decode("utf-8"))
result = instance_result_dict.copy() result = instance_result_dict.copy()
result.pop("date") result.pop("date")
self.assertEquals(result, self.assertEqual(result,
expected_result_dict) expected_result_dict)
# validate returned json result # validate returned json result
......
...@@ -161,7 +161,7 @@ class RunPromise(GenericPromise): ...@@ -161,7 +161,7 @@ class RunPromise(GenericPromise):
u'execution-time': 0.1, u'execution-time': 0.1,
u'path': u'%s/my_promise.py' % self.promise_dir, u'path': u'%s/my_promise.py' % self.promise_dir,
} }
self.assertEquals(expected_result, my_result) self.assertEqual(expected_result, my_result)
result_file = os.path.join(self.output_dir, 'my_second_promise.status.json') result_file = os.path.join(self.output_dir, 'my_second_promise.status.json')
self.assertTrue(os.path.exists(result_file)) self.assertTrue(os.path.exists(result_file))
...@@ -176,7 +176,7 @@ class RunPromise(GenericPromise): ...@@ -176,7 +176,7 @@ class RunPromise(GenericPromise):
u'execution-time': 0.1, u'execution-time': 0.1,
u'path': u'%s/my_second_promise.py' % self.promise_dir, u'path': u'%s/my_second_promise.py' % self.promise_dir,
} }
self.assertEquals(expected_result, second_result) self.assertEqual(expected_result, second_result)
def test_promise_generic_failed(self): def test_promise_generic_failed(self):
promise_file = self.generatePromiseScript('my_promise.py', success=False) promise_file = self.generatePromiseScript('my_promise.py', success=False)
...@@ -197,7 +197,7 @@ class RunPromise(GenericPromise): ...@@ -197,7 +197,7 @@ class RunPromise(GenericPromise):
u'execution-time': 0.1, u'execution-time': 0.1,
u'path': u'%s/my_promise.py' % self.promise_dir, u'path': u'%s/my_promise.py' % self.promise_dir,
} }
self.assertEquals(expected_result, my_result) self.assertEqual(expected_result, my_result)
def test_promise_generic_status_change(self): def test_promise_generic_status_change(self):
promise_file = self.generatePromiseScript('my_promise.py', success=False) promise_file = self.generatePromiseScript('my_promise.py', success=False)
...@@ -218,7 +218,7 @@ class RunPromise(GenericPromise): ...@@ -218,7 +218,7 @@ class RunPromise(GenericPromise):
u'execution-time': 0.1, u'execution-time': 0.1,
u'path': u'%s/my_promise.py' % self.promise_dir, u'path': u'%s/my_promise.py' % self.promise_dir,
} }
self.assertEquals(expected_result, my_result) self.assertEqual(expected_result, my_result)
os.system('rm %s/*.pyc' % self.promise_dir) os.system('rm %s/*.pyc' % self.promise_dir)
time.sleep(2) time.sleep(2)
...@@ -237,7 +237,7 @@ class RunPromise(GenericPromise): ...@@ -237,7 +237,7 @@ class RunPromise(GenericPromise):
u'execution-time': 0.1, u'execution-time': 0.1,
u'path': u'%s/my_promise.py' % self.promise_dir, u'path': u'%s/my_promise.py' % self.promise_dir,
} }
self.assertEquals(expected_result, my_result) self.assertEqual(expected_result, my_result)
def test_promise_generic_periodicity(self): def test_promise_generic_periodicity(self):
promise_file = self.generatePromiseScript('my_promise.py', success=False, periodicity=0.03) promise_file = self.generatePromiseScript('my_promise.py', success=False, periodicity=0.03)
...@@ -305,7 +305,7 @@ class RunPromise(GenericPromise): ...@@ -305,7 +305,7 @@ class RunPromise(GenericPromise):
promise_runner.start() promise_runner.start()
result2 = json.loads(open(result_file).read().decode("utf-8")) result2 = json.loads(open(result_file).read().decode("utf-8"))
start_date2 = datetime.strptime(result2['result'].pop('date'), '%Y-%m-%dT%H:%M:%S') start_date2 = datetime.strptime(result2['result'].pop('date'), '%Y-%m-%dT%H:%M:%S')
self.assertEquals(expected_result, result2) self.assertEqual(expected_result, result2)
def test_promise_two_folder(self): def test_promise_two_folder(self):
...@@ -330,7 +330,7 @@ class RunPromise(GenericPromise): ...@@ -330,7 +330,7 @@ class RunPromise(GenericPromise):
u'execution-time': 0.1, u'execution-time': 0.1,
u'path': u'%s' % promise, u'path': u'%s' % promise,
} }
self.assertEquals(expected_result, result1) self.assertEqual(expected_result, result1)
result2 = json.loads(open(result2_file).read()) result2 = json.loads(open(result2_file).read())
start_date2 = datetime.strptime(result2['result'].pop('date'), '%Y-%m-%dT%H:%M:%S') start_date2 = datetime.strptime(result2['result'].pop('date'), '%Y-%m-%dT%H:%M:%S')
...@@ -343,7 +343,7 @@ class RunPromise(GenericPromise): ...@@ -343,7 +343,7 @@ class RunPromise(GenericPromise):
u'execution-time': 0.1, u'execution-time': 0.1,
u'path': u'%s' % promise2, u'path': u'%s' % promise2,
} }
self.assertEquals(expected_result, result2) self.assertEqual(expected_result, result2)
def test_promise_NOK(self): def test_promise_NOK(self):
promise = self.writePromiseNOK('promise_1') promise = self.writePromiseNOK('promise_1')
...@@ -363,14 +363,14 @@ class RunPromise(GenericPromise): ...@@ -363,14 +363,14 @@ class RunPromise(GenericPromise):
u'execution-time': 0.1, u'execution-time': 0.1,
u'path': u'%s' % promise, u'path': u'%s' % promise,
} }
self.assertEquals(expected_result, result1) self.assertEqual(expected_result, result1)
# second run # second run
promise_runner = MonitorPromiseLauncher(parser) promise_runner = MonitorPromiseLauncher(parser)
promise_runner.start() promise_runner.start()
result2 = json.loads(open(result_file).read().decode("utf-8")) result2 = json.loads(open(result_file).read().decode("utf-8"))
result2['result'].pop('date') result2['result'].pop('date')
self.assertEquals(expected_result, result2) self.assertEqual(expected_result, result2)
def test_promise_mixed(self): def test_promise_mixed(self):
promise = self.writePromiseOK('promise_1') promise = self.writePromiseOK('promise_1')
...@@ -390,7 +390,7 @@ class RunPromise(GenericPromise): ...@@ -390,7 +390,7 @@ class RunPromise(GenericPromise):
u'execution-time': 0.1, u'execution-time': 0.1,
u'path': u'%s' % promise, u'path': u'%s' % promise,
} }
self.assertEquals(expected_result, result1) self.assertEqual(expected_result, result1)
# second run with failure # second run with failure
time.sleep(1) time.sleep(1)
...@@ -403,5 +403,5 @@ class RunPromise(GenericPromise): ...@@ -403,5 +403,5 @@ class RunPromise(GenericPromise):
result2 = json.loads(open(result_file).read().decode("utf-8")) result2 = json.loads(open(result_file).read().decode("utf-8"))
result2['result'].pop('date') result2['result'].pop('date')
self.assertEquals(expected_result, result2) self.assertEqual(expected_result, result2)
...@@ -78,7 +78,7 @@ extra_config_dict = {{ ...@@ -78,7 +78,7 @@ extra_config_dict = {{
self.configureLauncher(enable_anomaly=True) self.configureLauncher(enable_anomaly=True)
self.launcher.run() self.launcher.run()
result = self.getPromiseResult(self.promise_name) result = self.getPromiseResult(self.promise_name)
self.assertEquals(result['result']['failed'], False) self.assertEqual(result['result']['failed'], False)
self.assertIn("Backup OK", result['result']['message']) self.assertIn("Backup OK", result['result']['message'])
def test_check_backup_fail(self): def test_check_backup_fail(self):
...@@ -103,7 +103,7 @@ extra_config_dict = {{ ...@@ -103,7 +103,7 @@ extra_config_dict = {{
with self.assertRaises(PromiseError): with self.assertRaises(PromiseError):
self.launcher.run() self.launcher.run()
result = self.getPromiseResult(self.promise_name) result = self.getPromiseResult(self.promise_name)
self.assertEquals(result['result']['failed'], True) self.assertEqual(result['result']['failed'], True)
self.assertIn("Backup didn't start at correct time", result['result']['message']) self.assertIn("Backup didn't start at correct time", result['result']['message'])
if __name__ == '__main__': if __name__ == '__main__':
......
...@@ -84,15 +84,15 @@ extra_config_dict = { ...@@ -84,15 +84,15 @@ extra_config_dict = {
self.configureLauncher() self.configureLauncher()
self.launcher.run() self.launcher.run()
result = self.getPromiseResult(self.promise_name) result = self.getPromiseResult(self.promise_name)
self.assertEquals(result['result']['failed'], False) self.assertEqual(result['result']['failed'], False)
self.assertEquals(result['result']['message'], "No result from collector database: disk check skipped") self.assertEqual(result['result']['message'], "No result from collector database: disk check skipped")
def test_disk_space_ok(self): def test_disk_space_ok(self):
self.configureLauncher() self.configureLauncher()
self.launcher.run() self.launcher.run()
result = self.getPromiseResult(self.promise_name) result = self.getPromiseResult(self.promise_name)
self.assertEquals(result['result']['failed'], False) self.assertEqual(result['result']['failed'], False)
self.assertEquals(result['result']['message'], "Disk usage: OK") self.assertEqual(result['result']['message'], "Disk usage: OK")
def test_disk_space_nok(self): def test_disk_space_nok(self):
with open(self.th_file, 'w') as f: with open(self.th_file, 'w') as f:
...@@ -101,8 +101,8 @@ extra_config_dict = { ...@@ -101,8 +101,8 @@ extra_config_dict = {
with self.assertRaises(PromiseError): with self.assertRaises(PromiseError):
self.launcher.run() self.launcher.run()
result = self.getPromiseResult(self.promise_name) result = self.getPromiseResult(self.promise_name)
self.assertEquals(result['result']['failed'], True) self.assertEqual(result['result']['failed'], True)
self.assertEquals(result['result']['message'], "Free disk space low: remaining 269.1 G (threshold: 291921381.0 G)") self.assertEqual(result['result']['message'], "Free disk space low: remaining 269.1 G (threshold: 291921381.0 G)")
def test_check_free_disk_with_unicode_string_path(self): def test_check_free_disk_with_unicode_string_path(self):
# set path unicode # set path unicode
...@@ -110,8 +110,8 @@ extra_config_dict = { ...@@ -110,8 +110,8 @@ extra_config_dict = {
self.configureLauncher() self.configureLauncher()
self.launcher.run() self.launcher.run()
result = self.getPromiseResult(self.promise_name) result = self.getPromiseResult(self.promise_name)
self.assertEquals(result['result']['failed'], False) self.assertEqual(result['result']['failed'], False)
self.assertEquals(result['result']['message'], "Disk usage: OK") self.assertEqual(result['result']['message'], "Disk usage: OK")
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()
...@@ -49,8 +49,8 @@ from slapos.promise.plugin.check_partition_deployment_state import RunPromise ...@@ -49,8 +49,8 @@ from slapos.promise.plugin.check_partition_deployment_state import RunPromise
self.configureLauncher() self.configureLauncher()
self.launcher.run() self.launcher.run()
result = self.getPromiseResult("partition-deployment-state.py") result = self.getPromiseResult("partition-deployment-state.py")
self.assertEquals(result['result']['failed'], False) self.assertEqual(result['result']['failed'], False)
self.assertEquals(result['result']['message'], 'buildout is OK') self.assertEqual(result['result']['message'], 'buildout is OK')
def test_partition_deployment_state_failed(self): def test_partition_deployment_state_failed(self):
content = """ content = """
...@@ -65,10 +65,10 @@ from slapos.promise.plugin.check_partition_deployment_state import RunPromise ...@@ -65,10 +65,10 @@ from slapos.promise.plugin.check_partition_deployment_state import RunPromise
result = self.getPromiseResult("partition-deployment-state.py") result = self.getPromiseResult("partition-deployment-state.py")
buildout_output = os.path.join(self.partition_dir, 'var/log', 'slapgrid-%s-error.log' % self.partition_id) buildout_output = os.path.join(self.partition_dir, 'var/log', 'slapgrid-%s-error.log' % self.partition_id)
self.assertEquals(result['result']['failed'], True) self.assertEqual(result['result']['failed'], True)
self.assertEquals(result['result']['message'], 'Buildout failed to process %s.' % self.partition_id) self.assertEqual(result['result']['message'], 'Buildout failed to process %s.' % self.partition_id)
with open(buildout_output) as f: with open(buildout_output) as f:
self.assertEquals(f.read(), message) self.assertEqual(f.read(), message)
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()
...@@ -50,7 +50,7 @@ extra_config_dict = { ...@@ -50,7 +50,7 @@ extra_config_dict = {
if result['result']['failed']: if result['result']['failed']:
self.assertTrue("CPU load is high" in result['result']['message']) self.assertTrue("CPU load is high" in result['result']['message'])
else: else:
self.assertEquals("CPU load is OK", result['result']['message'].strip()) self.assertEqual("CPU load is OK", result['result']['message'].strip())
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()
...@@ -67,8 +67,8 @@ extra_config_dict = { ...@@ -67,8 +67,8 @@ extra_config_dict = {
self.configureLauncher() self.configureLauncher()
self.launcher.run() self.launcher.run()
result = self.getPromiseResult(self.promise_name) result = self.getPromiseResult(self.promise_name)
self.assertEquals(result['result']['failed'], False) self.assertEqual(result['result']['failed'], False)
self.assertEquals(result['result']['message'], "Bootstrap didn't run!") self.assertEqual(result['result']['message'], "Bootstrap didn't run!")
def test_monitor_bootstrap_ok(self): def test_monitor_bootstrap_ok(self):
self.writeResult('') self.writeResult('')
...@@ -76,8 +76,8 @@ extra_config_dict = { ...@@ -76,8 +76,8 @@ extra_config_dict = {
self.configureLauncher() self.configureLauncher()
self.launcher.run() self.launcher.run()
result = self.getPromiseResult(self.promise_name) result = self.getPromiseResult(self.promise_name)
self.assertEquals(result['result']['failed'], False) self.assertEqual(result['result']['failed'], False)
self.assertEquals(result['result']['message'], "Bootstrap OK") self.assertEqual(result['result']['message'], "Bootstrap OK")
def test_monitor_bootstrap_fail(self): def test_monitor_bootstrap_fail(self):
self.writePid(2425) self.writePid(2425)
...@@ -85,9 +85,9 @@ extra_config_dict = { ...@@ -85,9 +85,9 @@ extra_config_dict = {
with self.assertRaises(PromiseError): with self.assertRaises(PromiseError):
self.launcher.run() self.launcher.run()
result = self.getPromiseResult(self.promise_name) result = self.getPromiseResult(self.promise_name)
self.assertEquals(result['result']['failed'], True) self.assertEqual(result['result']['failed'], True)
message = "Monitor bootstrap exited with error.\n ---- Latest monitor-boostrap.log ----\nBuildout running..." message = "Monitor bootstrap exited with error.\n ---- Latest monitor-boostrap.log ----\nBuildout running..."
self.assertEquals(result['result']['message'], message) self.assertEqual(result['result']['message'], message)
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()
...@@ -46,30 +46,30 @@ class TestApacheMPMWatchdog(unittest.TestCase): ...@@ -46,30 +46,30 @@ class TestApacheMPMWatchdog(unittest.TestCase):
server_status = f.read() server_status = f.read()
f.close() f.close()
self.assertEquals(['12345', '12346'], self.assertEqual(['12345', '12346'],
re.findall(search_pid_regex, server_status)) re.findall(search_pid_regex, server_status))
def test_loadJSONFile(self): def test_loadJSONFile(self):
self.assertEquals({}, self.assertEqual({},
loadJSONFile("couscous")) loadJSONFile("couscous"))
self.assertEquals( self.assertEqual(
{"1234": 1496161635.514768 , "4321": 1496161635.514768}, {"1234": 1496161635.514768 , "4321": 1496161635.514768},
loadJSONFile(os.path.join(self.base_path, "test_db.json"))) loadJSONFile(os.path.join(self.base_path, "test_db.json")))
self.assertEquals( self.assertEqual(
{}, {},
loadJSONFile(os.path.join(self.base_path, "corrupted_db.json"))) loadJSONFile(os.path.join(self.base_path, "corrupted_db.json")))
def test_writeJSONFile(self): def test_writeJSONFile(self):
# Check if don't raise. # Check if don't raise.
self.assertEquals(None, self.assertEqual(None,
writeJSONFile({}, None)) writeJSONFile({}, None))
current_pid = os.getpid() current_pid = os.getpid()
self.assertEquals(None, self.assertEqual(None,
writeJSONFile({"123482": 123, current_pid: 124}, writeJSONFile({"123482": 123, current_pid: 124},
os.path.join(self.base_path, "write_db.json"))) os.path.join(self.base_path, "write_db.json")))
...@@ -77,14 +77,14 @@ class TestApacheMPMWatchdog(unittest.TestCase): ...@@ -77,14 +77,14 @@ class TestApacheMPMWatchdog(unittest.TestCase):
json_content = f.read() json_content = f.read()
f.close() f.close()
self.assertEquals(json_content, self.assertEqual(json_content,
'{"%s": 124}' % current_pid) '{"%s": 124}' % current_pid)
def test_getServerStatus(self): def test_getServerStatus(self):
self.assertEquals(None, self.assertEqual(None,
getServerStatus("http://localhost/", None, None)) getServerStatus("http://localhost/", None, None))
self.assertEquals(None, self.assertEqual(None,
getServerStatus("http://localhost/", getServerStatus("http://localhost/",
"user", "password")) "user", "password"))
self.assertNotEquals(None, self.assertNotEquals(None,
......
...@@ -76,28 +76,28 @@ class TestCheckApacheDigestResult(unittest.TestCase): ...@@ -76,28 +76,28 @@ class TestCheckApacheDigestResult(unittest.TestCase):
def test_threshold_is_greater(self): def test_threshold_is_greater(self):
status, message = checkApachedexResult(self.base_dir, self.status_file, 60) status, message = checkApachedexResult(self.base_dir, self.status_file, 60)
self.assertEquals(ok_message_formater.format(80), message) self.assertEqual(ok_message_formater.format(80), message)
self.assertEquals(0, status) self.assertEqual(0, status)
def test_no_today_file_and_empty_yesterday_file(self): def test_no_today_file_and_empty_yesterday_file(self):
self._remove_file(self.today) self._remove_file(self.today)
status, message = checkApachedexResult(self.base_dir, self.status_file, 60) status, message = checkApachedexResult(self.base_dir, self.status_file, 60)
self.assertEquals(apdex_not_found_message, message) self.assertEqual(apdex_not_found_message, message)
self.assertEquals(1, status) self.assertEqual(1, status)
self._create_file(self.today, True) self._create_file(self.today, True)
def test_threshold_is_lower(self): def test_threshold_is_lower(self):
threshold = 90.0 threshold = 90.0
status, message = checkApachedexResult(self.base_dir, self.status_file, threshold) status, message = checkApachedexResult(self.base_dir, self.status_file, threshold)
self.assertEquals(low_score_message_formater.format(80, threshold), message) self.assertEqual(low_score_message_formater.format(80, threshold), message)
self.assertEquals(1, status) self.assertEqual(1, status)
def test_no_today_file_but_yesterday_file(self): def test_no_today_file_but_yesterday_file(self):
self._remove_file(self.today) self._remove_file(self.today)
self._create_file(self.yesterday, True) self._create_file(self.yesterday, True)
status, message = checkApachedexResult(self.base_dir, self.status_file, 60) status, message = checkApachedexResult(self.base_dir, self.status_file, 60)
self.assertEquals(ok_message_formater.format(80), message) self.assertEqual(ok_message_formater.format(80), message)
self.assertEquals(0, status) self.assertEqual(0, status)
self._create_file(self.today, True) self._create_file(self.today, True)
self._remove_file(self.yesterday) self._remove_file(self.yesterday)
self._create_file(self.yesterday, False) self._create_file(self.yesterday, False)
......
...@@ -49,7 +49,7 @@ class TestComputerMemory(unittest.TestCase): ...@@ -49,7 +49,7 @@ class TestComputerMemory(unittest.TestCase):
self.conn.close() self.conn.close()
def test_check_memory(self): def test_check_memory(self):
self.assertEquals( self.assertEqual(
({ ({
'total': 33705312256, 'total': 33705312256,
'used': 33139023872, 'used': 33139023872,
...@@ -58,41 +58,41 @@ class TestComputerMemory(unittest.TestCase): ...@@ -58,41 +58,41 @@ class TestComputerMemory(unittest.TestCase):
'free_percent': 1.6801161184886904, 'free_percent': 1.6801161184886904,
}, ""), }, ""),
getMemoryInfo('/tmp', '00:02', '2017-09-15')) getMemoryInfo('/tmp', '00:02', '2017-09-15'))
self.assertEquals( self.assertEqual(
(True, "OK - memory used: 33139023872B of 33705312256B (98.3%)", ""), (True, "OK - memory used: 33139023872B of 33705312256B (98.3%)", ""),
checkMemoryUsage('/tmp', '00:02', '2017-09-15', threshold=33500000000), checkMemoryUsage('/tmp', '00:02', '2017-09-15', threshold=33500000000),
) )
self.assertEquals( self.assertEqual(
(True, "OK - memory used: 98.3% (33139023872B of 33705312256B)", ""), (True, "OK - memory used: 98.3% (33139023872B of 33705312256B)", ""),
checkMemoryUsage('/tmp', '00:02', '2017-09-15', threshold=99, unit="percent"), checkMemoryUsage('/tmp', '00:02', '2017-09-15', threshold=99, unit="percent"),
) )
self.assertEquals( self.assertEqual(
(True, "OK - free memory: 566288384B of 33705312256B (1.7%)", ""), (True, "OK - free memory: 566288384B of 33705312256B (1.7%)", ""),
checkMemoryUsage('/tmp', '00:02', '2017-09-15', threshold=500000000, key="free"), checkMemoryUsage('/tmp', '00:02', '2017-09-15', threshold=500000000, key="free"),
) )
self.assertEquals( self.assertEqual(
(True, "OK - free memory: 1.7% (566288384B of 33705312256B)", ""), (True, "OK - free memory: 1.7% (566288384B of 33705312256B)", ""),
checkMemoryUsage('/tmp', '00:02', '2017-09-15', threshold=1, key="free", unit="percent"), checkMemoryUsage('/tmp', '00:02', '2017-09-15', threshold=1, key="free", unit="percent"),
) )
self.assertEquals( self.assertEqual(
(False, "Low available memory - usage: 33139023872B of 33705312256B (98.3%)", ""), (False, "Low available memory - usage: 33139023872B of 33705312256B (98.3%)", ""),
checkMemoryUsage('/tmp', '00:02', '2017-09-15', threshold=33000000000), checkMemoryUsage('/tmp', '00:02', '2017-09-15', threshold=33000000000),
) )
self.assertEquals( self.assertEqual(
(False, "Low available memory - usage: 98.3% (33139023872B of 33705312256B)", ""), (False, "Low available memory - usage: 98.3% (33139023872B of 33705312256B)", ""),
checkMemoryUsage('/tmp', '00:02', '2017-09-15', threshold=98, unit="percent"), checkMemoryUsage('/tmp', '00:02', '2017-09-15', threshold=98, unit="percent"),
) )
self.assertEquals( self.assertEqual(
(False, "Low available memory - free: 566288384B of 33705312256B (1.7%)", ""), (False, "Low available memory - free: 566288384B of 33705312256B (1.7%)", ""),
checkMemoryUsage('/tmp', '00:02', '2017-09-15', threshold=600000000, key="free"), checkMemoryUsage('/tmp', '00:02', '2017-09-15', threshold=600000000, key="free"),
) )
self.assertEquals( self.assertEqual(
(False, "Low available memory - free: 1.7% (566288384B of 33705312256B)", ""), (False, "Low available memory - free: 1.7% (566288384B of 33705312256B)", ""),
checkMemoryUsage('/tmp', '00:02', '2017-09-15', threshold=2, key="free", unit="percent"), checkMemoryUsage('/tmp', '00:02', '2017-09-15', threshold=2, key="free", unit="percent"),
) )
def test_check_memory_with_unavailable_dates(self): def test_check_memory_with_unavailable_dates(self):
self.assertEquals( self.assertEqual(
(False, "error", total_memory_fetch_failure_message), (False, "error", total_memory_fetch_failure_message),
checkMemoryUsage('/tmp', '18:00', '2017-09-14', 1.0), checkMemoryUsage('/tmp', '18:00', '2017-09-14', 1.0),
) )
......
...@@ -63,31 +63,31 @@ class TestCheckErrorOnApacheLog(unittest.TestCase): ...@@ -63,31 +63,31 @@ class TestCheckErrorOnApacheLog(unittest.TestCase):
self._update_logs() self._update_logs()
def test_no_error(self): def test_no_error(self):
self.assertEquals("OK", self.assertEqual("OK",
test(self.base_path + "/SOFTINST-0_infoonly_error_log", 0)) test(self.base_path + "/SOFTINST-0_infoonly_error_log", 0))
self.assertEquals("OK", self.assertEqual("OK",
test(self.base_path + "/SOFTINST-0_infoonly_error_log", 3600)) test(self.base_path + "/SOFTINST-0_infoonly_error_log", 3600))
def test_error(self): def test_error(self):
self.assertEquals("ERROR=2 (NOTROUTE=2, UNREACHEABLENET=0, TIMEOUT=0)", self.assertEqual("ERROR=2 (NOTROUTE=2, UNREACHEABLENET=0, TIMEOUT=0)",
test(self.base_path + "/SOFTINST-0_apache_error_log", 0)) test(self.base_path + "/SOFTINST-0_apache_error_log", 0))
self.assertEquals("ERROR=1 (NOTROUTE=1, UNREACHEABLENET=0, TIMEOUT=0)", self.assertEqual("ERROR=1 (NOTROUTE=1, UNREACHEABLENET=0, TIMEOUT=0)",
test(self.base_path + "/SOFTINST-0_apache_error_log", 3600)) test(self.base_path + "/SOFTINST-0_apache_error_log", 3600))
def test_error_timeout(self): def test_error_timeout(self):
self.assertEquals("ERROR=4 (NOTROUTE=0, UNREACHEABLENET=0, TIMEOUT=4)", self.assertEqual("ERROR=4 (NOTROUTE=0, UNREACHEABLENET=0, TIMEOUT=4)",
test(self.base_path + "/SOFTINST-0_timeout_error_log", 0)) test(self.base_path + "/SOFTINST-0_timeout_error_log", 0))
self.assertEquals("ERROR=2 (NOTROUTE=0, UNREACHEABLENET=0, TIMEOUT=2)", self.assertEqual("ERROR=2 (NOTROUTE=0, UNREACHEABLENET=0, TIMEOUT=2)",
test(self.base_path + "/SOFTINST-0_timeout_error_log", 3600)) test(self.base_path + "/SOFTINST-0_timeout_error_log", 3600))
def test_error_unreacheabler(self): def test_error_unreacheabler(self):
self.assertEquals("ERROR=11 (NOTROUTE=0, UNREACHEABLENET=11, TIMEOUT=0)", self.assertEqual("ERROR=11 (NOTROUTE=0, UNREACHEABLENET=11, TIMEOUT=0)",
test(self.base_path + "/SOFTINST-0_unreachable_error_log", 0)) test(self.base_path + "/SOFTINST-0_unreachable_error_log", 0))
self.assertEquals("ERROR=11 (NOTROUTE=0, UNREACHEABLENET=11, TIMEOUT=0)", self.assertEqual("ERROR=11 (NOTROUTE=0, UNREACHEABLENET=11, TIMEOUT=0)",
test(self.base_path + "/SOFTINST-0_unreachable_error_log", 3600)) test(self.base_path + "/SOFTINST-0_unreachable_error_log", 3600))
if __name__ == '__main__': if __name__ == '__main__':
......
...@@ -35,19 +35,19 @@ class TestCheckRe6stOptimalStatus(unittest.TestCase): ...@@ -35,19 +35,19 @@ class TestCheckRe6stOptimalStatus(unittest.TestCase):
def test_ipv6_is_faster(self): def test_ipv6_is_faster(self):
result = test('::1', '8.8.8.8', 5) result = test('::1', '8.8.8.8', 5)
self.assertEquals(result, 'OK') self.assertEqual(result, 'OK')
def test_ipv4_is_faster(self): def test_ipv4_is_faster(self):
result = test('2001:67c:1254::1', '127.0.0.1', 5) result = test('2001:67c:1254::1', '127.0.0.1', 5)
self.assertEquals(result, 'FAIL') self.assertEqual(result, 'FAIL')
def test_ipv4_unreacheable_and_ipv6_ok(self): def test_ipv4_unreacheable_and_ipv6_ok(self):
result = test('::1', 'couscous', 5) result = test('::1', 'couscous', 5)
self.assertEquals(result, 'OK') self.assertEqual(result, 'OK')
def test_ipv6_fail(self): def test_ipv6_fail(self):
result = test('couscous', '127.0.0.1', 5) result = test('couscous', '127.0.0.1', 5)
self.assertEquals(result, 'FAILED') self.assertEqual(result, 'FAILED')
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()
...@@ -71,27 +71,27 @@ class TestCheckSlowQueriesDigestResult(unittest.TestCase): ...@@ -71,27 +71,27 @@ class TestCheckSlowQueriesDigestResult(unittest.TestCase):
def test_threshold_is_greater(self): def test_threshold_is_greater(self):
status, message = checkMariadbDigestResult(self.base_dir, self.status_file, 5000, 100) status, message = checkMariadbDigestResult(self.base_dir, self.status_file, 5000, 100)
self.assertEquals("Thanks for keeping it all clean, total queries are : 3420.0 slowest query time is : 34", message) self.assertEqual("Thanks for keeping it all clean, total queries are : 3420.0 slowest query time is : 34", message)
self.assertEquals(0, status) self.assertEqual(0, status)
def test_no_today_file_and_empty_yesterday_file(self): def test_no_today_file_and_empty_yesterday_file(self):
self._remove_file(self.today) self._remove_file(self.today)
status, message = checkMariadbDigestResult(self.base_dir, self.status_file, 60, 100) status, message = checkMariadbDigestResult(self.base_dir, self.status_file, 60, 100)
self.assertEquals("No result found in the slow query digest file or the file is corrupted", message) self.assertEqual("No result found in the slow query digest file or the file is corrupted", message)
self.assertEquals(1, status) self.assertEqual(1, status)
self._create_file(self.today, True) self._create_file(self.today, True)
def test_fail(self): def test_fail(self):
status, message = checkMariadbDigestResult(self.base_dir, self.status_file, 90, 100) status, message = checkMariadbDigestResult(self.base_dir, self.status_file, 90, 100)
self.assertEquals("Threshold is lower than expected: \nExpected total queries : 90 and current is: 3420.0\nExpected slowest query : 100 and current is: 34", message) self.assertEqual("Threshold is lower than expected: \nExpected total queries : 90 and current is: 3420.0\nExpected slowest query : 100 and current is: 34", message)
self.assertEquals(1, status) self.assertEqual(1, status)
def test_no_today_file_but_yesterday_file(self): def test_no_today_file_but_yesterday_file(self):
self._remove_file(self.today) self._remove_file(self.today)
self._create_file(self.yesterday, True) self._create_file(self.yesterday, True)
status, message = checkMariadbDigestResult(self.base_dir, self.status_file, 5000, 100) status, message = checkMariadbDigestResult(self.base_dir, self.status_file, 5000, 100)
self.assertEquals("Thanks for keeping it all clean, total queries are : 3420.0 slowest query time is : 34", message) self.assertEqual("Thanks for keeping it all clean, total queries are : 3420.0 slowest query time is : 34", message)
self.assertEquals(0, status) self.assertEqual(0, status)
self._create_file(self.today, True) self._create_file(self.today, True)
self._remove_file(self.yesterday) self._remove_file(self.yesterday)
self._create_file(self.yesterday, False) self._create_file(self.yesterday, False)
......
...@@ -51,7 +51,7 @@ class TestUserMemory(unittest.TestCase): ...@@ -51,7 +51,7 @@ class TestUserMemory(unittest.TestCase):
self.conn.close() self.conn.close()
def test_check_memory(self): def test_check_memory(self):
self.assertEquals( self.assertEqual(
({ ({
'byte': 29544162598, 'byte': 29544162598,
'percent': 87.65432099725093, 'percent': 87.65432099725093,
...@@ -62,7 +62,7 @@ class TestUserMemory(unittest.TestCase): ...@@ -62,7 +62,7 @@ class TestUserMemory(unittest.TestCase):
'slaptestuser1', 'slaptestuser1',
), ),
) )
self.assertEquals( self.assertEqual(
(True, "User memory usage: 29544162598B (87.7%)", ""), (True, "User memory usage: 29544162598B (87.7%)", ""),
checkMemoryUsage( checkMemoryUsage(
self.db_dir, self.db_dir,
...@@ -71,7 +71,7 @@ class TestUserMemory(unittest.TestCase): ...@@ -71,7 +71,7 @@ class TestUserMemory(unittest.TestCase):
threshold=29600000000, threshold=29600000000,
), ),
) )
self.assertEquals( self.assertEqual(
(True, "User memory usage: 87.7% (29544162598B)", ""), (True, "User memory usage: 87.7% (29544162598B)", ""),
checkMemoryUsage( checkMemoryUsage(
self.db_dir, self.db_dir,
...@@ -81,7 +81,7 @@ class TestUserMemory(unittest.TestCase): ...@@ -81,7 +81,7 @@ class TestUserMemory(unittest.TestCase):
unit="percent", unit="percent",
), ),
) )
self.assertEquals( self.assertEqual(
(False, "High user memory usage: 29544162598B (87.7%)", ""), (False, "High user memory usage: 29544162598B (87.7%)", ""),
checkMemoryUsage( checkMemoryUsage(
self.db_dir, self.db_dir,
...@@ -90,7 +90,7 @@ class TestUserMemory(unittest.TestCase): ...@@ -90,7 +90,7 @@ class TestUserMemory(unittest.TestCase):
threshold=29500000000, threshold=29500000000,
), ),
) )
self.assertEquals( self.assertEqual(
(False, "High user memory usage: 87.7% (29544162598B)", ""), (False, "High user memory usage: 87.7% (29544162598B)", ""),
checkMemoryUsage( checkMemoryUsage(
self.db_dir, self.db_dir,
...@@ -102,7 +102,7 @@ class TestUserMemory(unittest.TestCase): ...@@ -102,7 +102,7 @@ class TestUserMemory(unittest.TestCase):
) )
def test_check_memory_with_unavailable_dates(self): def test_check_memory_with_unavailable_dates(self):
self.assertEquals( self.assertEqual(
(False, "error", no_result_message), (False, "error", no_result_message),
checkMemoryUsage(self.db_dir, datetime(2017, 9, 14, 18, 0 , 0), "slaptestuser1", 1.0), checkMemoryUsage(self.db_dir, datetime(2017, 9, 14, 18, 0 , 0), "slaptestuser1", 1.0),
) )
......
...@@ -35,23 +35,23 @@ class TestIsICMPPacketLost(unittest.TestCase): ...@@ -35,23 +35,23 @@ class TestIsICMPPacketLost(unittest.TestCase):
def test_localhost(self): def test_localhost(self):
result = test("localhost", True, 5) result = test("localhost", True, 5)
self.assertEquals(result[4], '0') self.assertEqual(result[4], '0')
def test_error(self): def test_error(self):
result = test("couscous", True, 5) result = test("couscous", True, 5)
self.assertEquals(result[4], -1) self.assertEqual(result[4], -1)
def test_localhost6 (self): def test_localhost6 (self):
result = test("::1", False, 5) result = test("::1", False, 5)
self.assertEquals(result[4], '0') self.assertEqual(result[4], '0')
def test_error6(self): def test_error6(self):
result = test("couscous", False, 5) result = test("couscous", False, 5)
self.assertEquals(result[4], -1) self.assertEqual(result[4], -1)
def test_error_4_6(self): def test_error_4_6(self):
result = test("::1", True, 5) result = test("::1", True, 5)
self.assertEquals(result[4], -1) self.assertEqual(result[4], -1)
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()
......
...@@ -34,10 +34,10 @@ from slapos.promise.is_local_tcp_port_opened import isLocalTcpPortOpened ...@@ -34,10 +34,10 @@ from slapos.promise.is_local_tcp_port_opened import isLocalTcpPortOpened
class TestLocalTcpPortOpened(unittest.TestCase): class TestLocalTcpPortOpened(unittest.TestCase):
def test_port_is_not_open(self): def test_port_is_not_open(self):
self.assertEquals(isLocalTcpPortOpened("127.0.0.1",65550), False) self.assertEqual(isLocalTcpPortOpened("127.0.0.1",65550), False)
def test_port6_is_not_open(self): def test_port6_is_not_open(self):
self.assertEquals(isLocalTcpPortOpened("::1",65550), False) self.assertEqual(isLocalTcpPortOpened("::1",65550), False)
def test_port_is_open(self): def test_port_is_open(self):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
...@@ -45,7 +45,7 @@ class TestLocalTcpPortOpened(unittest.TestCase): ...@@ -45,7 +45,7 @@ class TestLocalTcpPortOpened(unittest.TestCase):
s.bind(("127.0.0.1", 0)) s.bind(("127.0.0.1", 0))
s.listen(1) s.listen(1)
port = s.getsockname()[1] port = s.getsockname()[1]
self.assertEquals(isLocalTcpPortOpened("127.0.0.1",port), True) self.assertEqual(isLocalTcpPortOpened("127.0.0.1",port), True)
finally: finally:
s.close() s.close()
...@@ -55,7 +55,7 @@ class TestLocalTcpPortOpened(unittest.TestCase): ...@@ -55,7 +55,7 @@ class TestLocalTcpPortOpened(unittest.TestCase):
s.bind(("::1", 0)) s.bind(("::1", 0))
s.listen(1) s.listen(1)
port = s.getsockname()[1] port = s.getsockname()[1]
self.assertEquals(isLocalTcpPortOpened("::1",port), True) self.assertEqual(isLocalTcpPortOpened("::1",port), True)
finally: finally:
s.close() s.close()
......
...@@ -91,26 +91,26 @@ class TestTestMap(unittest.TestCase): ...@@ -91,26 +91,26 @@ class TestTestMap(unittest.TestCase):
def test_group(self): def test_group(self):
""" Check available group of tests """ """ Check available group of tests """
self.assertEquals(self.test_map.getGroupList(), self.assertEqual(self.test_map.getGroupList(),
["COMP-1", "COMP-2"]) ["COMP-1", "COMP-2"])
def test_getnextgroup(self): def test_getnextgroup(self):
""" Get Next Group """ """ Get Next Group """
self.assertEquals(self.test_map.getNextGroup([]), self.assertEqual(self.test_map.getNextGroup([]),
"COMP-1") "COMP-1")
self.assertEquals( self.assertEqual(
self.test_map.getNextGroup(ignore_list=["COMP-1"]), self.test_map.getNextGroup(ignore_list=["COMP-1"]),
"COMP-2") "COMP-2")
def test_getexcludelist(self): def test_getexcludelist(self):
""" Check available group of tests """ """ Check available group of tests """
self.assertEquals(self.test_map.getExcludeList("COMP-1"), self.assertEqual(self.test_map.getExcludeList("COMP-1"),
set(['test-agent-software-release', set(['test-agent-software-release',
'test-wendelin-software-release', 'test-wendelin-software-release',
'test-monitor-software-release', 'test-monitor-software-release',
'test-re6stnetmaster-software-release', 'test-re6stnetmaster-software-release',
'test-powerdns-software-release'])) 'test-powerdns-software-release']))
self.assertEquals( self.assertEqual(
self.test_map.getExcludeList("COMP-2"), self.test_map.getExcludeList("COMP-2"),
set(['test-apache-frontend-software-release', set(['test-apache-frontend-software-release',
'test-slapos-master-software-release', 'test-slapos-master-software-release',
...@@ -120,7 +120,7 @@ class TestTestMap(unittest.TestCase): ...@@ -120,7 +120,7 @@ class TestTestMap(unittest.TestCase):
'test-nayuos-software-release'])) 'test-nayuos-software-release']))
self.test_map.addRanTest('test-agent-software-release') self.test_map.addRanTest('test-agent-software-release')
self.assertEquals( self.assertEqual(
self.test_map.getExcludeList("COMP-2"), self.test_map.getExcludeList("COMP-2"),
set(['test-apache-frontend-software-release', set(['test-apache-frontend-software-release',
'test-slapos-master-software-release', 'test-slapos-master-software-release',
...@@ -133,22 +133,22 @@ class TestTestMap(unittest.TestCase): ...@@ -133,22 +133,22 @@ class TestTestMap(unittest.TestCase):
def test_dropgroup(self): def test_dropgroup(self):
""" Check available group of tests """ """ Check available group of tests """
test_map_copy = TestMap(TESTMAP_DICT) test_map_copy = TestMap(TESTMAP_DICT)
self.assertEquals(test_map_copy.getGroupList(), self.assertEqual(test_map_copy.getGroupList(),
["COMP-1", "COMP-2"]) ["COMP-1", "COMP-2"])
test_map_copy.dropGroup("COMP-1") test_map_copy.dropGroup("COMP-1")
self.assertEquals(test_map_copy.getGroupList(), self.assertEqual(test_map_copy.getGroupList(),
["COMP-2"]) ["COMP-2"])
def test_cleanup_empty_group(self): def test_cleanup_empty_group(self):
""" Check available group of tests """ """ Check available group of tests """
test_map_copy = TestMap(TESTMAP_DICT) test_map_copy = TestMap(TESTMAP_DICT)
test_map_copy.test_map_dict["NEWGROUP"] = {} test_map_copy.test_map_dict["NEWGROUP"] = {}
self.assertEquals(test_map_copy.getGroupList(), self.assertEqual(test_map_copy.getGroupList(),
["COMP-1", "COMP-2", "NEWGROUP"]) ["COMP-1", "COMP-2", "NEWGROUP"])
test_map_copy.cleanEmptyGroup() test_map_copy.cleanEmptyGroup()
self.assertEquals(test_map_copy.getGroupList(), self.assertEqual(test_map_copy.getGroupList(),
["COMP-1", "COMP-2"]) ["COMP-1", "COMP-2"])
class TestAutoSTemp(unittest.TestCase): class TestAutoSTemp(unittest.TestCase):
...@@ -158,7 +158,7 @@ class TestAutoSTemp(unittest.TestCase): ...@@ -158,7 +158,7 @@ class TestAutoSTemp(unittest.TestCase):
removes it when deleted. removes it when deleted.
""" """
f = AutoSTemp("foo") f = AutoSTemp("foo")
self.assertEquals(open(f.name, "r").read(), "foo") self.assertEqual(open(f.name, "r").read(), "foo")
fname = f.name fname = f.name
self.assertTrue(os.path.isfile(fname)) self.assertTrue(os.path.isfile(fname))
del f del f
......
...@@ -75,10 +75,10 @@ class TestCheckFeedAsPromise(unittest.TestCase): ...@@ -75,10 +75,10 @@ class TestCheckFeedAsPromise(unittest.TestCase):
feed = self.generateOKFeed() feed = self.generateOKFeed()
option.ok_pattern_list = ['OK'] option.ok_pattern_list = ['OK']
self.assertEquals(checkFeedAsPromise(feed, option), "") self.assertEqual(checkFeedAsPromise(feed, option), "")
option.title, option.description = False, True option.title, option.description = False, True
option.ok_pattern_list = ['DONE', 'OK'] option.ok_pattern_list = ['DONE', 'OK']
self.assertEquals(checkFeedAsPromise(feed, option), "") self.assertEqual(checkFeedAsPromise(feed, option), "")
def test_ifKOFoundErrorReturned(self): def test_ifKOFoundErrorReturned(self):
...@@ -111,7 +111,7 @@ class TestCheckFeedAsPromise(unittest.TestCase): ...@@ -111,7 +111,7 @@ class TestCheckFeedAsPromise(unittest.TestCase):
feed = self.generateKOFeed([extra_item,]) feed = self.generateKOFeed([extra_item,])
option.time_buffer = 4000 option.time_buffer = 4000
# buffer longer than last item's age # buffer longer than last item's age
self.assertEquals(checkFeedAsPromise(feed, option), "") self.assertEqual(checkFeedAsPromise(feed, option), "")
# shorter buffer, we want to raise an error # shorter buffer, we want to raise an error
option.time_buffer = 1800 option.time_buffer = 1800
...@@ -123,7 +123,7 @@ class TestCheckFeedAsPromise(unittest.TestCase): ...@@ -123,7 +123,7 @@ class TestCheckFeedAsPromise(unittest.TestCase):
option.title = True option.title = True
feed = self.generateFeed([]) feed = self.generateFeed([])
self.assertEquals(checkFeedAsPromise(feed, option), "") self.assertEqual(checkFeedAsPromise(feed, option), "")
if __name__ == '__main__': if __name__ == '__main__':
......
...@@ -45,14 +45,14 @@ class TestDNSBench(unittest.TestCase): ...@@ -45,14 +45,14 @@ class TestDNSBench(unittest.TestCase):
info = dnsbench.resolve( info = dnsbench.resolve(
"www.erp5.com", DNS_EXPECTED_LIST) "www.erp5.com", DNS_EXPECTED_LIST)
self.assertEquals(info[0], 'DNS') self.assertEqual(info[0], 'DNS')
self.assertEquals(info[1], 'www.erp5.com') self.assertEqual(info[1], 'www.erp5.com')
self.assertEquals(info[2], 200) self.assertEqual(info[2], 200)
self.assertTrue(info[3] < 1) self.assertTrue(info[3] < 1)
self.assertEquals(info[4], 'OK', self.assertEqual(info[4], 'OK',
"%s != OK, full info: %s" % (info[4], info) ) "%s != OK, full info: %s" % (info[4], info) )
self.assertEquals(set(info[5]), set([u'85.118.38.162', u'176.31.129.213']), self.assertEqual(set(info[5]), set([u'85.118.38.162', u'176.31.129.213']),
"%s != set([u'85.118.38.162', u'176.31.129.213']), full info: %s" % (set(info[5]), info)) "%s != set([u'85.118.38.162', u'176.31.129.213']), full info: %s" % (set(info[5]), info))
def test_dnsbench_fail(self): def test_dnsbench_fail(self):
...@@ -61,13 +61,13 @@ class TestDNSBench(unittest.TestCase): ...@@ -61,13 +61,13 @@ class TestDNSBench(unittest.TestCase):
info = dnsbench.resolve( info = dnsbench.resolve(
"thisdomaindontexist.erp5.com") "thisdomaindontexist.erp5.com")
self.assertEquals(info[0], 'DNS') self.assertEqual(info[0], 'DNS')
self.assertEquals(info[1], 'thisdomaindontexist.erp5.com') self.assertEqual(info[1], 'thisdomaindontexist.erp5.com')
self.assertEquals(info[2], 600) self.assertEqual(info[2], 600)
self.assertTrue(info[3] < 1) self.assertTrue(info[3] < 1)
self.assertEquals(info[4], 'Cannot resolve the hostname') self.assertEqual(info[4], 'Cannot resolve the hostname')
self.assertEquals(info[5], []) self.assertEqual(info[5], [])
def test_dnsbench_unexpected(self): def test_dnsbench_unexpected(self):
""" Test dns unexpected resolution """ Test dns unexpected resolution
...@@ -75,52 +75,52 @@ class TestDNSBench(unittest.TestCase): ...@@ -75,52 +75,52 @@ class TestDNSBench(unittest.TestCase):
info = dnsbench.resolve( info = dnsbench.resolve(
"www.erp5.com", [DNS_EXPECTED_LIST[0]]) "www.erp5.com", [DNS_EXPECTED_LIST[0]])
self.assertEquals(info[0], 'DNS') self.assertEqual(info[0], 'DNS')
self.assertEquals(info[1], 'www.erp5.com') self.assertEqual(info[1], 'www.erp5.com')
self.assertEquals(info[2], 200) self.assertEqual(info[2], 200)
self.assertTrue(info[3] < 1) self.assertTrue(info[3] < 1)
self.assertEquals(info[4], 'UNEXPECTED') self.assertEqual(info[4], 'UNEXPECTED')
self.assertTrue(info[5].startswith("['85.118.38.162'] (expected) != ")) self.assertTrue(info[5].startswith("['85.118.38.162'] (expected) != "))
class TestPing(unittest.TestCase): class TestPing(unittest.TestCase):
def test_ping_ok(self): def test_ping_ok(self):
info = ping("localhost") info = ping("localhost")
self.assertEquals(info[0], 'PING') self.assertEqual(info[0], 'PING')
self.assertEquals(info[1], 'localhost') self.assertEqual(info[1], 'localhost')
self.assertEquals(info[2], 200) self.assertEqual(info[2], 200)
self.assertTrue(float(info[3]) < 0.2) self.assertTrue(float(info[3]) < 0.2)
self.assertEquals(info[4], '0') self.assertEqual(info[4], '0')
self.assertTrue(info[5].startswith("min")) self.assertTrue(info[5].startswith("min"))
def test_ping_fail(self): def test_ping_fail(self):
info = ping("couscous") info = ping("couscous")
self.assertEquals(info[0], 'PING') self.assertEqual(info[0], 'PING')
self.assertEquals(info[1], 'couscous') self.assertEqual(info[1], 'couscous')
self.assertEquals(info[2], 600) self.assertEqual(info[2], 600)
self.assertEquals(info[3], 'failed') self.assertEqual(info[3], 'failed')
self.assertEquals(info[4], -1) self.assertEqual(info[4], -1)
self.assertEquals(info[5], 'Fail to parser ping output') self.assertEqual(info[5], 'Fail to parser ping output')
def test_ping6_ok(self): def test_ping6_ok(self):
info = ping6("localhost") info = ping6("localhost")
self.assertEquals(info[0], 'PING6') self.assertEqual(info[0], 'PING6')
self.assertEquals(info[1], 'localhost') self.assertEqual(info[1], 'localhost')
self.assertEquals(info[2], 200) self.assertEqual(info[2], 200)
self.assertTrue(float(info[3]) < 0.2) self.assertTrue(float(info[3]) < 0.2)
self.assertEquals(info[4], '0') self.assertEqual(info[4], '0')
self.assertTrue(info[5].startswith("min")) self.assertTrue(info[5].startswith("min"))
def test_ping6_fail(self): def test_ping6_fail(self):
info = ping6("couscous") info = ping6("couscous")
self.assertEquals(info[0], 'PING6') self.assertEqual(info[0], 'PING6')
self.assertEquals(info[1], 'couscous') self.assertEqual(info[1], 'couscous')
self.assertEquals(info[2], 600) self.assertEqual(info[2], 600)
self.assertEquals(info[3], 'failed') self.assertEqual(info[3], 'failed')
self.assertEquals(info[4], -1) self.assertEqual(info[4], -1)
self.assertEquals(info[5], 'Fail to parser ping output') self.assertEqual(info[5], 'Fail to parser ping output')
class TestHTTPBench(unittest.TestCase): class TestHTTPBench(unittest.TestCase):
...@@ -131,11 +131,11 @@ class TestHTTPBench(unittest.TestCase): ...@@ -131,11 +131,11 @@ class TestHTTPBench(unittest.TestCase):
""" """
info = request("https://www.erp5.com", {}) info = request("https://www.erp5.com", {})
self.assertEquals(info[0], 'GET') self.assertEqual(info[0], 'GET')
self.assertEquals(info[1], 'https://www.erp5.com') self.assertEqual(info[1], 'https://www.erp5.com')
self.assertEquals(info[2], 200) self.assertEqual(info[2], 200)
self.assertEquals(len(info[3].split(';')), 5 ) self.assertEqual(len(info[3].split(';')), 5 )
self.assertEquals(info[4], "OK") self.assertEqual(info[4], "OK")
def test_request_expected_response(self): def test_request_expected_response(self):
""" This test is way to badly written as it depends on """ This test is way to badly written as it depends on
...@@ -143,11 +143,11 @@ class TestHTTPBench(unittest.TestCase): ...@@ -143,11 +143,11 @@ class TestHTTPBench(unittest.TestCase):
""" """
info = request("https://www.erp5.com", {"expected_response": 200}) info = request("https://www.erp5.com", {"expected_response": 200})
self.assertEquals(info[0], 'GET') self.assertEqual(info[0], 'GET')
self.assertEquals(info[1], 'https://www.erp5.com') self.assertEqual(info[1], 'https://www.erp5.com')
self.assertEquals(info[2], 200) self.assertEqual(info[2], 200)
self.assertEquals(len(info[3].split(';')), 5 ) self.assertEqual(len(info[3].split(';')), 5 )
self.assertEquals(info[4], "OK") self.assertEqual(info[4], "OK")
def test_request_expected_redirection(self): def test_request_expected_redirection(self):
""" This test is way to badly written as it depends on """ This test is way to badly written as it depends on
...@@ -155,11 +155,11 @@ class TestHTTPBench(unittest.TestCase): ...@@ -155,11 +155,11 @@ class TestHTTPBench(unittest.TestCase):
""" """
info = request("http://www.erp5.com", {"expected_response": 302}) info = request("http://www.erp5.com", {"expected_response": 302})
self.assertEquals(info[0], 'GET') self.assertEqual(info[0], 'GET')
self.assertEquals(info[1], 'http://www.erp5.com') self.assertEqual(info[1], 'http://www.erp5.com')
self.assertEquals(info[2], 302) self.assertEqual(info[2], 302)
self.assertEquals(len(info[3].split(';')), 5 ) self.assertEqual(len(info[3].split(';')), 5 )
self.assertEquals(info[4], "OK") self.assertEqual(info[4], "OK")
def test_request_expected_text(self): def test_request_expected_text(self):
...@@ -168,11 +168,11 @@ class TestHTTPBench(unittest.TestCase): ...@@ -168,11 +168,11 @@ class TestHTTPBench(unittest.TestCase):
""" """
info = request("https://www.erp5.com", {"expected_text": "ERP5"}) info = request("https://www.erp5.com", {"expected_text": "ERP5"})
self.assertEquals(info[0], 'GET') self.assertEqual(info[0], 'GET')
self.assertEquals(info[1], 'https://www.erp5.com') self.assertEqual(info[1], 'https://www.erp5.com')
self.assertEquals(info[2], 200) self.assertEqual(info[2], 200)
self.assertEquals(len(info[3].split(';')), 5 ) self.assertEqual(len(info[3].split(';')), 5 )
self.assertEquals(info[4], "OK") self.assertEqual(info[4], "OK")
def test_request_fail(self): def test_request_fail(self):
...@@ -180,11 +180,11 @@ class TestHTTPBench(unittest.TestCase): ...@@ -180,11 +180,11 @@ class TestHTTPBench(unittest.TestCase):
""" """
info = request("http://thisurldontexist.erp5.com", {}) info = request("http://thisurldontexist.erp5.com", {})
self.assertEquals(info[0], 'GET') self.assertEqual(info[0], 'GET')
self.assertEquals(info[1], 'http://thisurldontexist.erp5.com') self.assertEqual(info[1], 'http://thisurldontexist.erp5.com')
self.assertEquals(info[2], 0) self.assertEqual(info[2], 0)
self.assertEquals(len(info[3].split(';')), 5 ) self.assertEqual(len(info[3].split(';')), 5 )
self.assertEquals(info[4], "FAIL") self.assertEqual(info[4], "FAIL")
def test_request_unexpected_response(self): def test_request_unexpected_response(self):
""" This test is way to badly written as it depends on """ This test is way to badly written as it depends on
...@@ -192,11 +192,11 @@ class TestHTTPBench(unittest.TestCase): ...@@ -192,11 +192,11 @@ class TestHTTPBench(unittest.TestCase):
""" """
info = request("http://www.erp5.com", {"expected_response": 200}) info = request("http://www.erp5.com", {"expected_response": 200})
self.assertEquals(info[0], 'GET') self.assertEqual(info[0], 'GET')
self.assertEquals(info[1], 'http://www.erp5.com') self.assertEqual(info[1], 'http://www.erp5.com')
self.assertEquals(info[2], 302) self.assertEqual(info[2], 302)
self.assertEquals(len(info[3].split(';')), 5 ) self.assertEqual(len(info[3].split(';')), 5 )
self.assertEquals(info[4], "UNEXPECTED (200 != 302)") self.assertEqual(info[4], "UNEXPECTED (200 != 302)")
def test_request_unexpected_text(self): def test_request_unexpected_text(self):
""" This test is way to badly written as it depends on """ This test is way to badly written as it depends on
...@@ -204,11 +204,11 @@ class TestHTTPBench(unittest.TestCase): ...@@ -204,11 +204,11 @@ class TestHTTPBench(unittest.TestCase):
""" """
info = request("https://www.erp5.com", {"expected_text": "COUSCOUS"}) info = request("https://www.erp5.com", {"expected_text": "COUSCOUS"})
self.assertEquals(info[0], 'GET') self.assertEqual(info[0], 'GET')
self.assertEquals(info[1], 'https://www.erp5.com') self.assertEqual(info[1], 'https://www.erp5.com')
self.assertEquals(info[2], 200) self.assertEqual(info[2], 200)
self.assertEquals(len(info[3].split(';')), 5 ) self.assertEqual(len(info[3].split(';')), 5 )
self.assertEquals(info[4], "UNEXPECTED (COUSCOUS not in page content)") self.assertEqual(info[4], "UNEXPECTED (COUSCOUS not in page content)")
......
...@@ -186,8 +186,8 @@ class TestQemuQMPWrapper(unittest.TestCase): ...@@ -186,8 +186,8 @@ class TestQemuQMPWrapper(unittest.TestCase):
} }
} }
qmpwrapper.setVNCPassword("my password") qmpwrapper.setVNCPassword("my password")
self.assertEquals(len(self.call_stack_list), 1) self.assertEqual(len(self.call_stack_list), 1)
self.assertEquals(self.call_stack_list[0], expected_result) self.assertEqual(self.call_stack_list[0], expected_result)
def test_updateDevice_cpu_add(self): def test_updateDevice_cpu_add(self):
self.free_cpu_slot_amount = 4 self.free_cpu_slot_amount = 4
...@@ -226,8 +226,8 @@ class TestQemuQMPWrapper(unittest.TestCase): ...@@ -226,8 +226,8 @@ class TestQemuQMPWrapper(unittest.TestCase):
{'execute': 'query-cpus'} {'execute': 'query-cpus'}
] ]
self.assertEquals(len(self.call_stack_list), 4) self.assertEqual(len(self.call_stack_list), 4)
self.assertEquals(self.call_stack_list, expected_result) self.assertEqual(self.call_stack_list, expected_result)
def test_updateDevice_cpu_increase(self): def test_updateDevice_cpu_increase(self):
self.free_cpu_slot_amount = 2 self.free_cpu_slot_amount = 2
...@@ -266,8 +266,8 @@ class TestQemuQMPWrapper(unittest.TestCase): ...@@ -266,8 +266,8 @@ class TestQemuQMPWrapper(unittest.TestCase):
{'execute': 'query-cpus'} {'execute': 'query-cpus'}
] ]
self.assertEquals(len(self.call_stack_list), 4) self.assertEqual(len(self.call_stack_list), 4)
self.assertEquals(self.call_stack_list, expected_result) self.assertEqual(self.call_stack_list, expected_result)
def test_updateDevice_cpu_remove(self): def test_updateDevice_cpu_remove(self):
self.free_cpu_slot_amount = 2 self.free_cpu_slot_amount = 2
...@@ -292,8 +292,8 @@ class TestQemuQMPWrapper(unittest.TestCase): ...@@ -292,8 +292,8 @@ class TestQemuQMPWrapper(unittest.TestCase):
{'execute': 'query-cpus'} {'execute': 'query-cpus'}
] ]
self.assertEquals(len(self.call_stack_list), 3) self.assertEqual(len(self.call_stack_list), 3)
self.assertEquals(self.call_stack_list, expected_result) self.assertEqual(self.call_stack_list, expected_result)
def test_updateDevice_cpu_no_update(self): def test_updateDevice_cpu_no_update(self):
self.free_cpu_slot_amount = 2 self.free_cpu_slot_amount = 2
...@@ -309,8 +309,8 @@ class TestQemuQMPWrapper(unittest.TestCase): ...@@ -309,8 +309,8 @@ class TestQemuQMPWrapper(unittest.TestCase):
{'execute': 'query-hotpluggable-cpus'} {'execute': 'query-hotpluggable-cpus'}
] ]
self.assertEquals(len(self.call_stack_list), 1) self.assertEqual(len(self.call_stack_list), 1)
self.assertEquals(self.call_stack_list, expected_result) self.assertEqual(self.call_stack_list, expected_result)
def test_updateDevice_memory_add(self): def test_updateDevice_memory_add(self):
self.hotplugged_memory_amount = 0 self.hotplugged_memory_amount = 0
...@@ -364,8 +364,8 @@ class TestQemuQMPWrapper(unittest.TestCase): ...@@ -364,8 +364,8 @@ class TestQemuQMPWrapper(unittest.TestCase):
{'execute': 'query-memory-devices'} {'execute': 'query-memory-devices'}
] ]
self.assertEquals(len(self.call_stack_list), 7) self.assertEqual(len(self.call_stack_list), 7)
self.assertEquals(self.call_stack_list, expected_result) self.assertEqual(self.call_stack_list, expected_result)
def test_updateDevice_memory_increase(self): def test_updateDevice_memory_increase(self):
qmpwrapper = QemuQMPWrapper(self.socket_file, auto_connect=False) qmpwrapper = QemuQMPWrapper(self.socket_file, auto_connect=False)
...@@ -403,8 +403,8 @@ class TestQemuQMPWrapper(unittest.TestCase): ...@@ -403,8 +403,8 @@ class TestQemuQMPWrapper(unittest.TestCase):
{'execute': 'query-memory-devices'} {'execute': 'query-memory-devices'}
] ]
self.assertEquals(len(self.call_stack_list), 5) self.assertEqual(len(self.call_stack_list), 5)
self.assertEquals(self.call_stack_list, expected_result) self.assertEqual(self.call_stack_list, expected_result)
def test_updateDevice_memory_delete(self): def test_updateDevice_memory_delete(self):
qmpwrapper = QemuQMPWrapper(self.socket_file, auto_connect=False) qmpwrapper = QemuQMPWrapper(self.socket_file, auto_connect=False)
...@@ -444,8 +444,8 @@ class TestQemuQMPWrapper(unittest.TestCase): ...@@ -444,8 +444,8 @@ class TestQemuQMPWrapper(unittest.TestCase):
{'execute': 'query-memory-devices'} {'execute': 'query-memory-devices'}
] ]
self.assertEquals(len(self.call_stack_list), 7) self.assertEqual(len(self.call_stack_list), 7)
self.assertEquals(self.call_stack_list, expected_result) self.assertEqual(self.call_stack_list, expected_result)
def test_updateDevice_memory_delete_all(self): def test_updateDevice_memory_delete_all(self):
qmpwrapper = QemuQMPWrapper(self.socket_file, auto_connect=False) qmpwrapper = QemuQMPWrapper(self.socket_file, auto_connect=False)
...@@ -493,8 +493,8 @@ class TestQemuQMPWrapper(unittest.TestCase): ...@@ -493,8 +493,8 @@ class TestQemuQMPWrapper(unittest.TestCase):
{'execute': 'query-memory-devices'} {'execute': 'query-memory-devices'}
] ]
self.assertEquals(len(self.call_stack_list), 9) self.assertEqual(len(self.call_stack_list), 9)
self.assertEquals(self.call_stack_list, expected_result) self.assertEqual(self.call_stack_list, expected_result)
def test_updateDevice_memory_no_update(self): def test_updateDevice_memory_no_update(self):
qmpwrapper = QemuQMPWrapper(self.socket_file, auto_connect=False) qmpwrapper = QemuQMPWrapper(self.socket_file, auto_connect=False)
...@@ -515,8 +515,8 @@ class TestQemuQMPWrapper(unittest.TestCase): ...@@ -515,8 +515,8 @@ class TestQemuQMPWrapper(unittest.TestCase):
{'execute': 'query-memdev'} {'execute': 'query-memdev'}
] ]
self.assertEquals(len(self.call_stack_list), 2) self.assertEqual(len(self.call_stack_list), 2)
self.assertEquals(self.call_stack_list, expected_result) self.assertEqual(self.call_stack_list, expected_result)
def test_updateDevice_memory_will_reboot(self): def test_updateDevice_memory_will_reboot(self):
qmpwrapper = QemuQMPWrapper(self.socket_file, auto_connect=False) qmpwrapper = QemuQMPWrapper(self.socket_file, auto_connect=False)
...@@ -563,8 +563,8 @@ class TestQemuQMPWrapper(unittest.TestCase): ...@@ -563,8 +563,8 @@ class TestQemuQMPWrapper(unittest.TestCase):
{'execute': 'quit'} {'execute': 'quit'}
] ]
self.assertEquals(len(self.call_stack_list), 9) self.assertEqual(len(self.call_stack_list), 9)
self.assertEquals(self.call_stack_list, expected_result) self.assertEqual(self.call_stack_list, expected_result)
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment