Commit 812d00c4 authored by Thomas Gambier's avatar Thomas Gambier 🚴🏼

CLEANUP: use assertNotEqual instead of assertNotEquals

assertNotEquals is deprecated since 3.2 (see https://docs.python.org/3.7/library/unittest.html#deprecated-aliases)
This is a followup of 175b5788
parent 42b2b5ef
......@@ -164,7 +164,7 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin):
new_indexation_timestamp = portal.portal_catalog(
uid=order.getUid(),
select_dict={'indexation_timestamp': None})[0].indexation_timestamp
self.assertNotEquals(new_indexation_timestamp,
self.assertNotEqual(new_indexation_timestamp,
indexation_timestamp)
def test_OpenSaleOrder_reindexIfIndexedBeforeLine_line_indexed_before(self):
......
......@@ -65,7 +65,7 @@ class TestSlapOSComputer_reportComputerConsumption(SlapOSTestCaseMixinWithAbort)
self.assertEqual(document.getSourceReference(), new_id)
self.assertEqual(document.getTitle(),
"%s consumption (%s)" % (computer.getReference(), new_id))
self.assertNotEquals(document.getReference(), "")
self.assertNotEqual(document.getReference(), "")
self.assertEqual(document.getVersion(), "1")
self.assertEqual(document.getData(), consumption_xml)
self.assertEqual(document.getClassification(), "personal")
......
......@@ -86,7 +86,7 @@ class TestSlapOSSoftwareInstance_requestValidationPayment(SlapOSTestCaseMixinWit
contract = instance.SoftwareInstance_requestValidationPayment()
self.commit()
contract2 = instance.SoftwareInstance_requestValidationPayment()
self.assertNotEquals(contract, None)
self.assertNotEqual(contract, None)
self.assertEqual(contract2, None)
def test_addCloudContract_existing_invalidated_contract(self):
......@@ -95,7 +95,7 @@ class TestSlapOSSoftwareInstance_requestValidationPayment(SlapOSTestCaseMixinWit
self.commit()
self.tic()
contract2 = instance.SoftwareInstance_requestValidationPayment()
self.assertNotEquals(contract, None)
self.assertNotEqual(contract, None)
self.assertEqual(contract2.getRelativeUrl(), contract.getRelativeUrl())
def test_addCloudContract_existing_validated_contract(self):
......@@ -105,7 +105,7 @@ class TestSlapOSSoftwareInstance_requestValidationPayment(SlapOSTestCaseMixinWit
self.commit()
self.tic()
contract2 = instance.SoftwareInstance_requestValidationPayment()
self.assertNotEquals(contract, None)
self.assertNotEqual(contract, None)
self.assertEqual(contract2.getRelativeUrl(), contract.getRelativeUrl())
def test_do_nothing_if_validated_contract(self):
......@@ -148,7 +148,7 @@ class TestSlapOSSoftwareInstance_requestValidationPayment(SlapOSTestCaseMixinWit
contract2 = instance.SoftwareInstance_requestValidationPayment()
after_date = DateTime()
self.assertEqual(contract2.getRelativeUrl(), contract.getRelativeUrl())
self.assertNotEquals(contract2.getCausality(""), "")
self.assertNotEqual(contract2.getCausality(""), "")
self.assertEqual(contract2.getValidationState(), "invalidated")
invoice = contract2.getCausalityValue()
......
......@@ -56,7 +56,7 @@ class TestSlapOSSecurityMixin(SlapOSTestCaseMixin):
system.
"""
uf = self.getUserFolder()
self.assertNotEquals(uf.getUserById(user_id, None), None)
self.assertNotEqual(uf.getUserById(user_id, None), None)
for _, plugin in uf._getOb('plugins').listPlugins(
IAuthenticationPlugin ):
if plugin.authenticateCredentials(
......
......@@ -2347,9 +2347,9 @@ class TestSlapOSCorePersonRequest(SlapOSTestCaseMixin):
)
hosting_subscription2 = person.REQUEST.get('request_hosting_subscription')
self.assertNotEquals(hosting_subscription.getRelativeUrl(),
self.assertNotEqual(hosting_subscription.getRelativeUrl(),
hosting_subscription2.getRelativeUrl())
self.assertNotEquals(hosting_subscription.getReference(),
self.assertNotEqual(hosting_subscription.getReference(),
hosting_subscription2.getReference())
self.assertEqual(software_release2,
......@@ -2450,7 +2450,7 @@ class TestSlapOSCorePersonRequest(SlapOSTestCaseMixin):
)
hosting_subscription2 = person.REQUEST.get('request_hosting_subscription')
self.assertEqual("start_requested", hosting_subscription2.getSlapState())
self.assertNotEquals(hosting_subscription.getRelativeUrl(),
self.assertNotEqual(hosting_subscription.getRelativeUrl(),
hosting_subscription2.getRelativeUrl())
class TestSlapOSCorePersonRequestComputer(SlapOSTestCaseMixin):
......
......@@ -22,7 +22,7 @@ class TestSlapOSConfigurator(SlapOSTestCaseMixin):
self.assertEqual(self.portal.portal_ids.checkConsistency(), [])
self.portal.person_module.setIdGenerator("_Id_fake")
self.assertNotEquals(self.portal.portal_ids.checkConsistency(), [])
self.assertNotEqual(self.portal.portal_ids.checkConsistency(), [])
self.portal.portal_ids.fixConsistency()
self.assertEqual(self.portal.portal_ids.checkConsistency(), [])
self.assertEqual(self.portal.person_module.getIdGenerator(),
......
......@@ -434,8 +434,8 @@ The slapos team
ticket, event = person.Person_checkToCreateRegularisationRequest()
transaction.commit()
ticket2, event2 = person.Person_checkToCreateRegularisationRequest()
self.assertNotEquals(ticket, None)
self.assertNotEquals(event, None)
self.assertNotEqual(ticket, None)
self.assertNotEqual(event, None)
self.assertEqual(ticket2, None)
self.assertEqual(event2, None)
......@@ -456,8 +456,8 @@ The slapos team
transaction.commit()
self.tic()
ticket2, event2 = person.Person_checkToCreateRegularisationRequest()
self.assertNotEquals(ticket, None)
self.assertNotEquals(event, None)
self.assertNotEqual(ticket, None)
self.assertNotEqual(event, None)
self.assertEqual(ticket2.getRelativeUrl(), ticket.getRelativeUrl())
self.assertEqual(event2, None)
......@@ -469,8 +469,8 @@ The slapos team
transaction.commit()
self.tic()
ticket2, event2 = person.Person_checkToCreateRegularisationRequest()
self.assertNotEquals(ticket, None)
self.assertNotEquals(event, None)
self.assertNotEqual(ticket, None)
self.assertNotEqual(event, None)
self.assertEqual(ticket2.getRelativeUrl(), ticket.getRelativeUrl())
self.assertEqual(event2, None)
......@@ -482,8 +482,8 @@ The slapos team
transaction.commit()
self.tic()
ticket2, event2 = person.Person_checkToCreateRegularisationRequest()
self.assertNotEquals(ticket2.getRelativeUrl(), ticket.getRelativeUrl())
self.assertNotEquals(event2, None)
self.assertNotEqual(ticket2.getRelativeUrl(), ticket.getRelativeUrl())
self.assertNotEqual(event2, None)
def test_addRegularisationRequest_REQUEST_disallowed(self):
person = self.makePerson(index=0, user=0)
......@@ -634,7 +634,7 @@ class TestSlapOSRegularisationRequest_checkToSendUniqEvent(SlapOSTestCaseMixin):
'service_module/slapos_crm_spam', 'foo2 title', 'foo2 content', 'foo2 comment')
self.assertEqual(ticket.getResource(), 'foo/bar')
self.assertNotEquals(event.getTitle(), 'foo2 title')
self.assertNotEqual(event.getTitle(), 'foo2 title')
self.assertEqual(event.getTextContent(), None)
self.assertEqual(event.getSimulationState(), 'draft')
self.assertEqual(event.getRelativeUrl(), event2.getRelativeUrl())
......@@ -666,7 +666,7 @@ class TestSlapOSRegularisationRequest_checkToSendUniqEvent(SlapOSTestCaseMixin):
transaction.commit()
event2 = ticket.RegularisationRequest_checkToSendUniqEvent(
'service_module/slapos_crm_spam', 'foo2 title', 'foo2 content', 'foo2 comment')
self.assertNotEquals(event, event2)
self.assertNotEqual(event, event2)
self.assertEqual(event2, None)
def test_checkToSendUniqEvent_REQUEST_disallowed(self):
......@@ -1956,7 +1956,7 @@ class TestSlapOSComputer_notifyWrongAllocationScope(TestCRMSkinsMixin):
self.tic()
self.assertEqual(computer.getAllocationScope(), 'open/personal')
#ticket = self._getGeneratedSupportRequest(computer)
self.assertNotEquals(None, ticket)
self.assertNotEqual(None, ticket)
self.assertEqual(ticket.getSimulationState(), 'suspended')
self.assertEqual('Visited by SupportRequest_trySendNotificationMessage ' \
......@@ -3116,7 +3116,7 @@ class TestSupportRequestTrySendNotificationMessage(SlapOSTestCaseMixin):
self.assertEqual(title, first_event.getTitle())
self.assertEqual(text_content, first_event.getTextContent())
self.assertNotEquals(None, first_event.getStartDate())
self.assertNotEqual(None, first_event.getStartDate())
self.assertEqual("service_module/slapos_crm_information",
first_event.getResource())
self.assertEqual(first_event.getDestination(), person.getRelativeUrl())
......@@ -3130,7 +3130,7 @@ class TestSupportRequestTrySendNotificationMessage(SlapOSTestCaseMixin):
self.assertEqual(title, event.getTitle())
self.assertEqual(text_content, event.getTextContent())
self.assertNotEquals(None, event.getStartDate())
self.assertNotEqual(None, event.getStartDate())
self.assertEqual("service_module/slapos_crm_information",
event.getResource())
self.assertEqual(event.getDestination(), person.getRelativeUrl())
......@@ -3143,7 +3143,7 @@ class TestSupportRequestTrySendNotificationMessage(SlapOSTestCaseMixin):
self.assertEqual(event.getTitle(), title)
self.assertEqual(text_content, event.getTextContent())
self.assertNotEquals(None, event.getStartDate())
self.assertNotEqual(None, event.getStartDate())
self.assertEqual("service_module/slapos_crm_information",
event.getResource())
self.assertEqual(event.getDestination(), person.getRelativeUrl())
......@@ -3168,7 +3168,7 @@ class TestSupportRequestTrySendNotificationMessage(SlapOSTestCaseMixin):
self.assertEqual(title, another_first_event.getTitle())
self.assertEqual(text_content, another_first_event.getTextContent())
self.assertNotEquals(None, another_first_event.getStartDate())
self.assertNotEqual(None, another_first_event.getStartDate())
self.assertEqual("service_module/slapos_crm_information",
another_first_event.getResource())
self.assertEqual(another_first_event.getDestination(), person.getRelativeUrl())
......
......@@ -637,7 +637,7 @@ class TestSlapOSDefaultScenario(DefaultScenarioMixin):
portal_type="Person",
user_id=user_id)
self.assertNotEquals(person, None)
self.assertNotEqual(person, None)
# User received an email for payment
email = person.getDefaultEmailText()
......
......@@ -114,11 +114,11 @@ class TestSlapOSPaymentTransaction_generatePayzenId(SlapOSTestCaseMixinWithAbort
# XXX Not indexed yet
# self.assertEqual(category, 'Causality/%s' % transaction_url)
self.assertNotEquals(payzen_id, None)
self.assertNotEqual(payzen_id, None)
self.assertEqual(len(payzen_id), 6)
self.assertEqual(str(int(payzen_id)).zfill(6), payzen_id)
self.assertNotEquals(transaction_date, None)
self.assertNotEqual(transaction_date, None)
self.assertEqual(transaction_date.timezone(), 'UTC')
self.assertEqual(transaction_date.asdatetime().strftime('%Y%m%d'),
DateTime().toZone('UTC').asdatetime().strftime('%Y%m%d'))
......@@ -137,7 +137,7 @@ class TestSlapOSPaymentTransaction_generatePayzenId(SlapOSTestCaseMixinWithAbort
date2, payzen_id2 = payment_transaction2.PaymentTransaction_generatePayzenId()
self.assertEqual(date.asdatetime().strftime('%Y%m%d'),
date2.asdatetime().strftime('%Y%m%d'))
self.assertNotEquals(payzen_id, payzen_id2)
self.assertNotEqual(payzen_id, payzen_id2)
self.assertTrue(int(payzen_id) < int(payzen_id2))
def test_generatePayzenId_REQUEST_disallowed(self):
......@@ -479,7 +479,7 @@ return addToDate(DateTime(), to_add={'day': -1, 'second': -1}).toZone('UTC'), 'f
self.assertEqual(
'Transaction not found on payzen side.',
event.workflow_history['system_event_workflow'][-1]['comment'])
self.assertNotEquals(payment.getSimulationState(), "cancelled")
self.assertNotEqual(payment.getSimulationState(), "cancelled")
self.assertEqual(
'Error code 2 (Not found) did not changed the document state.',
payment.workflow_history['edit_workflow'][-1]['comment'])
......@@ -722,7 +722,7 @@ class TestSlapOSPayzenSaleInvoiceTransaction_getPayzenPaymentRelatedValue(
invoice = self.createPayzenSaleInvoiceTransaction()
self.tic()
payment = invoice.SaleInvoiceTransaction_getPayzenPaymentRelatedValue()
self.assertNotEquals(None, payment)
self.assertNotEqual(None, payment)
self.assertEqual(payment.getSimulationState(), "started")
self.assertEqual(payment.getCausalityValue(), invoice)
self.assertEqual(payment.getPaymentModeUid(),
......
......@@ -168,8 +168,8 @@ class TestSlapOSPayzenInterfaceWorkflow(SlapOSTestCaseMixinWithAbort):
# Payment is registered
transaction_date, transaction_id = \
payment.PaymentTransaction_getPayzenId()
self.assertNotEquals(transaction_date, None)
self.assertNotEquals(transaction_id, None)
self.assertNotEqual(transaction_date, None)
self.assertNotEqual(transaction_id, None)
# Event state
self.assertEqual(event.getValidationState(), "acknowledged")
......
......@@ -250,7 +250,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
"""Login as a given username. The user must exist."""
uf = self.getPortal().acl_users
user = uf.getUserById(username)
self.assertNotEquals(user, None, 'No user %s' % username)
self.assertNotEqual(user, None, 'No user %s' % username)
newSecurityManager(None, user.__of__(uf))
########################################
......@@ -1499,7 +1499,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
if uri != software_release_uri:
sequence.edit(software_release_uri=uri)
break
self.assertNotEquals(sequence["software_release_uri"],
self.assertNotEqual(sequence["software_release_uri"],
old_software_release_uri)
def stepStoreSoftwareReleaseUri(self, sequence, **kw):
......@@ -2725,7 +2725,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
self.assertEqual("confirmed", sale_order_line.getSimulationState())
sale_packing_list_line = slave_instance.getAggregateRelatedValue(
portal_type=self.sale_packing_list_line_portal_type)
self.assertNotEquals(sale_packing_list_line.getAggregate(
self.assertNotEqual(sale_packing_list_line.getAggregate(
portal_type=self.computer_partition_portal_type), None)
def stepCheckSlaveInstanceAssociationWithSoftwareInstance(self, sequence):
......@@ -2824,7 +2824,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
def stepSlapLoginSoftwareInstanceFromCurrentSoftwareInstance(self, sequence):
software_instance = self._getSoftwareInstanceFromCurrentComputerPartition(
sequence)
self.assertNotEquals(None, software_instance)
self.assertNotEqual(None, software_instance)
self.stepSlapLogout()
global REMOTE_USER
REMOTE_USER = software_instance.getReference()
......
......@@ -382,18 +382,18 @@ class TestCollectSnapshot(unittest.TestCase):
process = psutil.Process(os.getpid())
process_snapshot = snapshot.ProcessSnapshot(process)
self.assertNotEquals(process_snapshot.username, None)
self.assertNotEqual(process_snapshot.username, None)
self.assertEqual(int(process_snapshot.pid), os.getpid())
self.assertEqual(int(process_snapshot.process.split("-")[0]),
os.getpid())
self.assertNotEquals(process_snapshot.cpu_percent , None)
self.assertNotEquals(process_snapshot.cpu_time , None)
self.assertNotEquals(process_snapshot.cpu_num_threads, None)
self.assertNotEquals(process_snapshot.memory_percent , None)
self.assertNotEquals(process_snapshot.memory_rss, None)
self.assertNotEquals(process_snapshot.io_rw_counter, None)
self.assertNotEquals(process_snapshot.io_cycles_counter, None)
self.assertNotEqual(process_snapshot.cpu_percent , None)
self.assertNotEqual(process_snapshot.cpu_time , None)
self.assertNotEqual(process_snapshot.cpu_num_threads, None)
self.assertNotEqual(process_snapshot.memory_percent , None)
self.assertNotEqual(process_snapshot.memory_rss, None)
self.assertNotEqual(process_snapshot.io_rw_counter, None)
self.assertNotEqual(process_snapshot.io_cycles_counter, None)
def test_folder_size_snapshot(self):
disk_snapshot = snapshot.FolderSizeSnapshot(self.instance_root)
......@@ -405,18 +405,18 @@ class TestCollectSnapshot(unittest.TestCase):
f.write('toto text')
disk_snapshot.update_folder_size()
self.assertNotEquals(disk_snapshot.disk_usage, 0)
self.assertNotEqual(disk_snapshot.disk_usage, 0)
pid_file = os.path.join(self.instance_root, 'disk_snap.pid')
disk_snapshot = snapshot.FolderSizeSnapshot(self.instance_root, pid_file)
disk_snapshot.update_folder_size()
self.assertNotEquals(disk_snapshot.disk_usage, 0)
self.assertNotEqual(disk_snapshot.disk_usage, 0)
pid_file = os.path.join(self.instance_root, 'disk_snap.pid')
disk_snapshot = snapshot.FolderSizeSnapshot(self.instance_root, pid_file,
use_quota=True)
disk_snapshot.update_folder_size()
self.assertNotEquals(disk_snapshot.disk_usage, 0)
self.assertNotEqual(disk_snapshot.disk_usage, 0)
def test_process_snapshot_broken_process(self):
......@@ -425,34 +425,34 @@ class TestCollectSnapshot(unittest.TestCase):
def test_computer_snapshot(self):
computer_snapshot = snapshot.ComputerSnapshot()
self.assertNotEquals(computer_snapshot.cpu_num_core , None)
self.assertNotEquals(computer_snapshot.cpu_frequency , None)
self.assertNotEquals(computer_snapshot.cpu_type , None)
self.assertNotEquals(computer_snapshot.memory_size , None)
self.assertNotEquals(computer_snapshot.memory_type , None)
self.assertNotEqual(computer_snapshot.cpu_num_core , None)
self.assertNotEqual(computer_snapshot.cpu_frequency , None)
self.assertNotEqual(computer_snapshot.cpu_type , None)
self.assertNotEqual(computer_snapshot.memory_size , None)
self.assertNotEqual(computer_snapshot.memory_type , None)
self.assertEqual(type(computer_snapshot.system_snapshot),
snapshot.SystemSnapshot)
self.assertNotEquals(computer_snapshot.disk_snapshot_list, [])
self.assertNotEquals(computer_snapshot.partition_list, [])
self.assertNotEqual(computer_snapshot.disk_snapshot_list, [])
self.assertNotEqual(computer_snapshot.partition_list, [])
self.assertEqual(type(computer_snapshot.disk_snapshot_list[0]),
snapshot.DiskPartitionSnapshot)
def test_system_snapshot(self):
system_snapshot = snapshot.SystemSnapshot()
self.assertNotEquals(system_snapshot.memory_used , None)
self.assertNotEquals(system_snapshot.memory_free , None)
self.assertNotEquals(system_snapshot.memory_percent , None)
self.assertNotEquals(system_snapshot.cpu_percent , None)
self.assertNotEquals(system_snapshot.load , None)
self.assertNotEquals(system_snapshot.net_in_bytes , None)
self.assertNotEquals(system_snapshot.net_in_errors, None)
self.assertNotEquals(system_snapshot.net_in_dropped , None)
self.assertNotEquals(system_snapshot.net_out_bytes , None)
self.assertNotEquals(system_snapshot.net_out_errors, None)
self.assertNotEquals(system_snapshot.net_out_dropped , None)
self.assertNotEqual(system_snapshot.memory_used , None)
self.assertNotEqual(system_snapshot.memory_free , None)
self.assertNotEqual(system_snapshot.memory_percent , None)
self.assertNotEqual(system_snapshot.cpu_percent , None)
self.assertNotEqual(system_snapshot.load , None)
self.assertNotEqual(system_snapshot.net_in_bytes , None)
self.assertNotEqual(system_snapshot.net_in_errors, None)
self.assertNotEqual(system_snapshot.net_in_dropped , None)
self.assertNotEqual(system_snapshot.net_out_bytes , None)
self.assertNotEqual(system_snapshot.net_out_errors, None)
self.assertNotEqual(system_snapshot.net_out_dropped , None)
class TestCollectEntity(unittest.TestCase):
......
......@@ -661,7 +661,7 @@ class RunPromise(GenericPromise):
first_result = json.load(open(first_state_file))
second_result = json.load(open(second_state_file))
self.assertNotEquals(first_result['result']['date'], first_date)
self.assertNotEqual(first_result['result']['date'], first_date)
self.assertEqual(second_result['result']['date'], second_date)
first_date = first_result['result']['date']
......@@ -673,8 +673,8 @@ class RunPromise(GenericPromise):
first_result = json.load(open(first_state_file))
second_result = json.load(open(second_state_file))
self.assertNotEquals(first_result['result']['date'], first_date)
self.assertNotEquals(second_result['result']['date'], second_date)
self.assertNotEqual(first_result['result']['date'], first_date)
self.assertNotEqual(second_result['result']['date'], second_date)
def test_runpromise_with_periodicity_result_failed_and_ok(self):
first_promise = 'my_first_promise.py'
......@@ -711,7 +711,7 @@ class RunPromise(GenericPromise):
first_result = json.load(open(first_state_file))
second_result = json.load(open(second_state_file))
self.assertNotEquals(first_result['result']['date'], first_date)
self.assertNotEqual(first_result['result']['date'], first_date)
self.assertEqual(second_result['result']['date'], second_date)
first_date = first_result['result']['date']
second_date = second_result['result']['date']
......@@ -727,8 +727,8 @@ class RunPromise(GenericPromise):
first_result = json.load(open(first_state_file))
second_result = json.load(open(second_state_file))
self.assertNotEquals(first_result['result']['date'], first_date)
self.assertNotEquals(second_result['result']['date'], second_date)
self.assertNotEqual(first_result['result']['date'], first_date)
self.assertNotEqual(second_result['result']['date'], second_date)
def test_runpromise_force(self):
first_promise = 'my_first_promise.py'
......
......@@ -38,7 +38,7 @@ class TestRegister(unittest.TestCase):
""" Simple test to Fetch the configuration template
"""
template = slapos.cli.register.fetch_configuration_template()
self.assertNotEquals("", template)
self.assertNotEqual("", template)
for entry in ['computer_id',
'master_url',
......
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