Commit 6b081951 authored by Jérome Perrin's avatar Jérome Perrin Committed by Rafael Monnerat

testSlapOSSlapTool: compare canonical XML

With the previous approach, the test depend on the order of attributes,
but this order is not stable when hash randomization is enabled and we
don't care about order of attributes in this test.
parent 08db1d8b
...@@ -12,7 +12,6 @@ import time ...@@ -12,7 +12,6 @@ import time
# blurb to make nice XML comparisions # blurb to make nice XML comparisions
from lxml import etree from lxml import etree
import difflib
import hashlib import hashlib
import json import json
from binascii import hexlify from binascii import hexlify
...@@ -38,7 +37,16 @@ class Simulator: ...@@ -38,7 +37,16 @@ class Simulator:
l.append({'recmethod': self.method, l.append({'recmethod': self.method,
'recargs': args, 'recargs': args,
'reckwargs': kwargs}) 'reckwargs': kwargs})
open(self.outfile, 'w').write(repr(l)) with open(self.outfile, 'w') as f:
f.write(repr(l))
def canonical_xml(xml):
return etree.tostring(
etree.fromstring(xml),
method="c14n",
).decode('utf-8')
class TestSlapOSSlapToolMixin(SlapOSTestCaseMixin): class TestSlapOSSlapToolMixin(SlapOSTestCaseMixin):
def afterSetUp(self): def afterSetUp(self):
...@@ -69,6 +77,9 @@ class TestSlapOSSlapToolMixin(SlapOSTestCaseMixin): ...@@ -69,6 +77,9 @@ class TestSlapOSSlapToolMixin(SlapOSTestCaseMixin):
self.unpinDateTime() self.unpinDateTime()
self._cleaupREQUEST() self._cleaupREQUEST()
def assertXMLEqual(self, first, second):
self.assertEqual(canonical_xml(first), canonical_xml(second))
class TestSlapOSSlapToolgetFullComputerInformation(TestSlapOSSlapToolMixin): class TestSlapOSSlapToolgetFullComputerInformation(TestSlapOSSlapToolMixin):
def test_activate_getFullComputerInformation_first_access(self): def test_activate_getFullComputerInformation_first_access(self):
...@@ -618,8 +629,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSSlapToolMixin): ...@@ -618,8 +629,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSSlapToolMixin):
start_requested_url=self.start_requested_software_installation.getUrlString(), start_requested_url=self.start_requested_software_installation.getUrlString(),
access_status="#error no data found!", access_status="#error no data found!",
) )
self.assertEqual(expected_xml, got_xml, self.assertXMLEqual(expected_xml, got_xml)
'\n'.join([q for q in difflib.unified_diff(expected_xml.split('\n'), got_xml.split('\n'))]))
def test_getComputeNodeInformation(self): def test_getComputeNodeInformation(self):
self.assertEqual('getFullComputerInformation', self.assertEqual('getFullComputerInformation',
...@@ -669,8 +679,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSSlapToolMixin): ...@@ -669,8 +679,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSSlapToolMixin):
since=since, since=since,
compute_node_id=self.compute_node_id compute_node_id=self.compute_node_id
) )
self.assertEqual(expected_xml, got_xml, self.assertXMLEqual(expected_xml, got_xml)
'\n'.join([q for q in difflib.unified_diff(expected_xml.split('\n'), got_xml.split('\n'))]))
def test_accessed_getComputerStatus(self): def test_accessed_getComputerStatus(self):
self.login(self.compute_node_user_id) self.login(self.compute_node_user_id)
...@@ -721,8 +730,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSSlapToolMixin): ...@@ -721,8 +730,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSSlapToolMixin):
since=since, since=since,
compute_node_id=self.compute_node_id compute_node_id=self.compute_node_id
) )
self.assertEqual(expected_xml, got_xml, self.assertXMLEqual(expected_xml, got_xml)
'\n'.join([q for q in difflib.unified_diff(expected_xml.split('\n'), got_xml.split('\n'))]))
def assertComputeNodeBangSimulator(self, args, kwargs): def assertComputeNodeBangSimulator(self, args, kwargs):
stored = eval(open(self.compute_node_bang_simulator).read()) #pylint: disable=eval-used stored = eval(open(self.compute_node_bang_simulator).read()) #pylint: disable=eval-used
...@@ -833,8 +841,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSSlapToolMixin): ...@@ -833,8 +841,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSSlapToolMixin):
since=since, since=since,
reference=software_installation.getReference() reference=software_installation.getReference()
) )
self.assertEqual(expected_xml, got_xml, self.assertXMLEqual(expected_xml, got_xml)
'\n'.join([q for q in difflib.unified_diff(expected_xml.split('\n'), got_xml.split('\n'))]))
def test_destroyedSoftwareRelease_noSoftwareInstallation(self): def test_destroyedSoftwareRelease_noSoftwareInstallation(self):
...@@ -907,8 +914,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSSlapToolMixin): ...@@ -907,8 +914,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSSlapToolMixin):
compute_node_id=self.compute_node_id, compute_node_id=self.compute_node_id,
reference=software_installation.getReference() reference=software_installation.getReference()
) )
self.assertEqual(expected_xml, got_xml, self.assertXMLEqual(expected_xml, got_xml)
'\n'.join([q for q in difflib.unified_diff(expected_xml.split('\n'), got_xml.split('\n'))]))
def test_buildingSoftwareRelease(self): def test_buildingSoftwareRelease(self):
self._makeComplexComputeNode() self._makeComplexComputeNode()
...@@ -957,8 +963,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSSlapToolMixin): ...@@ -957,8 +963,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSSlapToolMixin):
compute_node_id=self.compute_node_id, compute_node_id=self.compute_node_id,
reference=software_installation.getReference() reference=software_installation.getReference()
) )
self.assertEqual(expected_xml, got_xml, self.assertXMLEqual(expected_xml, got_xml)
'\n'.join([q for q in difflib.unified_diff(expected_xml.split('\n'), got_xml.split('\n'))]))
def test_softwareReleaseError(self): def test_softwareReleaseError(self):
self._makeComplexComputeNode() self._makeComplexComputeNode()
...@@ -1007,8 +1012,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSSlapToolMixin): ...@@ -1007,8 +1012,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSSlapToolMixin):
compute_node_id=self.compute_node_id, compute_node_id=self.compute_node_id,
reference=software_installation.getReference() reference=software_installation.getReference()
) )
self.assertEqual(expected_xml, got_xml, self.assertXMLEqual(expected_xml, got_xml)
'\n'.join([q for q in difflib.unified_diff(expected_xml.split('\n'), got_xml.split('\n'))]))
def test_useComputer_wrong_xml(self): def test_useComputer_wrong_xml(self):
self.login(self.compute_node_user_id) self.login(self.compute_node_user_id)
...@@ -1146,8 +1150,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin): ...@@ -1146,8 +1150,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
instance_certificate=self.start_requested_software_instance.getSslCertificate(), instance_certificate=self.start_requested_software_instance.getSslCertificate(),
instance_key=self.start_requested_software_instance.getSslKey() instance_key=self.start_requested_software_instance.getSslKey()
) )
self.assertEqual(expected_xml, got_xml, self.assertXMLEqual(expected_xml, got_xml)
'\n'.join([q for q in difflib.unified_diff(expected_xml.split('\n'), got_xml.split('\n'))]))
def test_getFullComputerInformation(self): def test_getFullComputerInformation(self):
self._makeComplexComputeNode(with_slave=True) self._makeComplexComputeNode(with_slave=True)
...@@ -1288,8 +1291,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin): ...@@ -1288,8 +1291,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
slave_1_title=self.start_requested_slave_instance.getTitle(), slave_1_title=self.start_requested_slave_instance.getTitle(),
access_status="#error no data found for %s" % self.start_requested_software_instance.getReference(), access_status="#error no data found for %s" % self.start_requested_software_instance.getReference(),
) )
self.assertEqual(expected_xml, got_xml, self.assertXMLEqual(expected_xml, got_xml)
'\n'.join([q for q in difflib.unified_diff(expected_xml.split('\n'), got_xml.split('\n'))]))
def test_getComputerPartitionStatus(self): def test_getComputerPartitionStatus(self):
self._makeComplexComputeNode() self._makeComplexComputeNode()
...@@ -1338,8 +1340,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin): ...@@ -1338,8 +1340,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
since=since, since=since,
instance_guid=self.start_requested_software_instance.getReference(), instance_guid=self.start_requested_software_instance.getReference(),
) )
self.assertEqual(expected_xml, got_xml, self.assertXMLEqual(expected_xml, got_xml)
'\n'.join([q for q in difflib.unified_diff(expected_xml.split('\n'), got_xml.split('\n'))]))
def test_getComputerPartitionStatus_visited(self): def test_getComputerPartitionStatus_visited(self):
self._makeComplexComputeNode() self._makeComplexComputeNode()
...@@ -1391,8 +1392,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin): ...@@ -1391,8 +1392,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
compute_node_id=self.compute_node_id, compute_node_id=self.compute_node_id,
partition_id=partition_id partition_id=partition_id
) )
self.assertEqual(expected_xml, got_xml, self.assertXMLEqual(expected_xml, got_xml)
'\n'.join([q for q in difflib.unified_diff(expected_xml.split('\n'), got_xml.split('\n'))]))
def test_registerComputerPartition_withSlave(self): def test_registerComputerPartition_withSlave(self):
self._makeComplexComputeNode(with_slave=True) self._makeComplexComputeNode(with_slave=True)
...@@ -1522,8 +1522,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin): ...@@ -1522,8 +1522,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
slave_1_instance_guid=self.start_requested_slave_instance.getReference(), slave_1_instance_guid=self.start_requested_slave_instance.getReference(),
slave_1_title=self.start_requested_slave_instance.getTitle(), slave_1_title=self.start_requested_slave_instance.getTitle(),
) )
self.assertEqual(expected_xml, got_xml, self.assertXMLEqual(expected_xml, got_xml)
'\n'.join([q for q in difflib.unified_diff(expected_xml.split('\n'), got_xml.split('\n'))]))
def test_registerComputerPartition(self): def test_registerComputerPartition(self):
self._makeComplexComputeNode() self._makeComplexComputeNode()
...@@ -1634,8 +1633,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin): ...@@ -1634,8 +1633,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
root_instance_title=self.start_requested_software_instance.getSpecialiseValue().getTitle(), root_instance_title=self.start_requested_software_instance.getSpecialiseValue().getTitle(),
software_type=self.start_requested_software_instance.getSourceReference() software_type=self.start_requested_software_instance.getSourceReference()
) )
self.assertEqual(expected_xml, got_xml, self.assertXMLEqual(expected_xml, got_xml)
'\n'.join([q for q in difflib.unified_diff(expected_xml.split('\n'), got_xml.split('\n'))]))
def assertInstanceUpdateConnectionSimulator(self, args, kwargs): def assertInstanceUpdateConnectionSimulator(self, args, kwargs):
stored = eval(open(self.instance_update_connection_simulator).read()) #pylint: disable=eval-used stored = eval(open(self.instance_update_connection_simulator).read()) #pylint: disable=eval-used
...@@ -1757,8 +1755,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin): ...@@ -1757,8 +1755,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
since = since, since = since,
instance_guid=self.start_requested_software_instance.getReference(), instance_guid=self.start_requested_software_instance.getReference(),
) )
self.assertEqual(expected_xml, got_xml, self.assertXMLEqual(expected_xml, got_xml)
'\n'.join([q for q in difflib.unified_diff(expected_xml.split('\n'), got_xml.split('\n'))]))
def test_softwareInstanceError_twice(self): def test_softwareInstanceError_twice(self):
self._makeComplexComputeNode() self._makeComplexComputeNode()
...@@ -1805,8 +1802,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin): ...@@ -1805,8 +1802,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
since = since, since = since,
instance_guid=self.start_requested_software_instance.getReference(), instance_guid=self.start_requested_software_instance.getReference(),
) )
self.assertEqual(expected_xml, got_xml, self.assertXMLEqual(expected_xml, got_xml)
'\n'.join([q for q in difflib.unified_diff(expected_xml.split('\n'), got_xml.split('\n'))]))
self.unpinDateTime() self.unpinDateTime()
time.sleep(1) time.sleep(1)
...@@ -1855,8 +1851,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin): ...@@ -1855,8 +1851,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
since = since, since = since,
instance_guid=self.start_requested_software_instance.getReference(), instance_guid=self.start_requested_software_instance.getReference(),
) )
self.assertEqual(expected_xml, got_xml, self.assertXMLEqual(expected_xml, got_xml)
'\n'.join([q for q in difflib.unified_diff(expected_xml.split('\n'), got_xml.split('\n'))]))
def assertInstanceBangSimulator(self, args, kwargs): def assertInstanceBangSimulator(self, args, kwargs):
stored = eval(open(self.instance_bang_simulator).read()) #pylint: disable=eval-used stored = eval(open(self.instance_bang_simulator).read()) #pylint: disable=eval-used
...@@ -1915,8 +1910,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin): ...@@ -1915,8 +1910,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
since=since, since=since,
instance_guid=self.start_requested_software_instance.getReference(), instance_guid=self.start_requested_software_instance.getReference(),
) )
self.assertEqual(expected_xml, got_xml, self.assertXMLEqual(expected_xml, got_xml)
'\n'.join([q for q in difflib.unified_diff(expected_xml.split('\n'), got_xml.split('\n'))]))
self.assertInstanceBangSimulator((), {'comment': error_log, 'bang_tree': True}) self.assertInstanceBangSimulator((), {'comment': error_log, 'bang_tree': True})
finally: finally:
if os.path.exists(self.instance_bang_simulator): if os.path.exists(self.instance_bang_simulator):
...@@ -2254,8 +2248,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin): ...@@ -2254,8 +2248,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
since=since, since=since,
instance_guid=self.start_requested_software_instance.getReference(), instance_guid=self.start_requested_software_instance.getReference(),
) )
self.assertEqual(expected_xml, got_xml, self.assertXMLEqual(expected_xml, got_xml)
'\n'.join([q for q in difflib.unified_diff(expected_xml.split('\n'), got_xml.split('\n'))]))
def test_startedComputePartition(self): def test_startedComputePartition(self):
self._makeComplexComputeNode() self._makeComplexComputeNode()
...@@ -2301,8 +2294,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin): ...@@ -2301,8 +2294,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
since=since, since=since,
instance_guid=self.start_requested_software_instance.getReference(), instance_guid=self.start_requested_software_instance.getReference(),
) )
self.assertEqual(expected_xml, got_xml, self.assertXMLEqual(expected_xml, got_xml)
'\n'.join([q for q in difflib.unified_diff(expected_xml.split('\n'), got_xml.split('\n'))]))
def test_getSoftwareReleaseListFromSoftwareProduct(self): def test_getSoftwareReleaseListFromSoftwareProduct(self):
new_id = self.generateNewId() new_id = self.generateNewId()
...@@ -2344,8 +2336,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin): ...@@ -2344,8 +2336,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
</list> </list>
</marshal> </marshal>
""" % (software_release2.getUrlString(), software_release1.getUrlString()) """ % (software_release2.getUrlString(), software_release1.getUrlString())
self.assertEqual(expected_xml, got_xml, self.assertXMLEqual(expected_xml, got_xml)
'\n'.join([q for q in difflib.unified_diff(expected_xml.split('\n'), got_xml.split('\n'))]))
def test_getSoftwareReleaseListFromSoftwareProduct_effectiveDate(self): def test_getSoftwareReleaseListFromSoftwareProduct_effectiveDate(self):
new_id = self.generateNewId() new_id = self.generateNewId()
...@@ -2391,8 +2382,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin): ...@@ -2391,8 +2382,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
</marshal> </marshal>
""" % (software_release3.getUrlString(), software_release1.getUrlString(), """ % (software_release3.getUrlString(), software_release1.getUrlString(),
software_release2.getUrlString()) software_release2.getUrlString())
self.assertEqual(expected_xml, got_xml, self.assertXMLEqual(expected_xml, got_xml)
'\n'.join([q for q in difflib.unified_diff(expected_xml.split('\n'), got_xml.split('\n'))]))
def test_getSoftwareReleaseListFromSoftwareProduct_emptySoftwareProduct(self): def test_getSoftwareReleaseListFromSoftwareProduct_emptySoftwareProduct(self):
new_id = self.generateNewId() new_id = self.generateNewId()
...@@ -2408,8 +2398,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin): ...@@ -2408,8 +2398,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
<list id="i2"/> <list id="i2"/>
</marshal> </marshal>
""" """
self.assertEqual(expected_xml, got_xml, self.assertXMLEqual(expected_xml, got_xml)
'\n'.join([q for q in difflib.unified_diff(expected_xml.split('\n'), got_xml.split('\n'))]))
def test_getSoftwareReleaseListFromSoftwareProduct_NoSoftwareProduct(self): def test_getSoftwareReleaseListFromSoftwareProduct_NoSoftwareProduct(self):
response = self.portal_slap.getSoftwareReleaseListFromSoftwareProduct( response = self.portal_slap.getSoftwareReleaseListFromSoftwareProduct(
...@@ -2422,8 +2411,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin): ...@@ -2422,8 +2411,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
<list id="i2"/> <list id="i2"/>
</marshal> </marshal>
""" """
self.assertEqual(expected_xml, got_xml, self.assertXMLEqual(expected_xml, got_xml)
'\n'.join([q for q in difflib.unified_diff(expected_xml.split('\n'), got_xml.split('\n'))]))
def test_getSoftwareReleaseListFromSoftwareProduct_fromUrl(self): def test_getSoftwareReleaseListFromSoftwareProduct_fromUrl(self):
new_id = self.generateNewId() new_id = self.generateNewId()
...@@ -2464,8 +2452,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin): ...@@ -2464,8 +2452,7 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
</list> </list>
</marshal> </marshal>
""" % (software_release2.getUrlString(), software_release1.getUrlString()) """ % (software_release2.getUrlString(), software_release1.getUrlString())
self.assertEqual(expected_xml, got_xml, self.assertXMLEqual(expected_xml, got_xml)
'\n'.join([q for q in difflib.unified_diff(expected_xml.split('\n'), got_xml.split('\n'))]))
class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin): class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
...@@ -2529,8 +2516,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin): ...@@ -2529,8 +2516,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
since=since, since=since,
compute_node_id=self.compute_node_id compute_node_id=self.compute_node_id
) )
self.assertEqual(expected_xml, got_xml, self.assertXMLEqual(expected_xml, got_xml)
'\n'.join([q for q in difflib.unified_diff(expected_xml.split('\n'), got_xml.split('\n'))]))
def test_accessed_getComputerStatus(self): def test_accessed_getComputerStatus(self):
self.login(self.compute_node_user_id) self.login(self.compute_node_user_id)
...@@ -2581,8 +2567,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin): ...@@ -2581,8 +2567,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
since=since, since=since,
compute_node_id=self.compute_node_id compute_node_id=self.compute_node_id
) )
self.assertEqual(expected_xml, got_xml, self.assertXMLEqual(expected_xml, got_xml)
'\n'.join([q for q in difflib.unified_diff(expected_xml.split('\n'), got_xml.split('\n'))]))
def assertComputeNodeBangSimulator(self, args, kwargs): def assertComputeNodeBangSimulator(self, args, kwargs):
stored = eval(open(self.compute_node_bang_simulator).read()) #pylint: disable=eval-used stored = eval(open(self.compute_node_bang_simulator).read()) #pylint: disable=eval-used
...@@ -2658,8 +2643,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin): ...@@ -2658,8 +2643,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
since=since, since=since,
instance_guid=self.start_requested_software_instance.getReference(), instance_guid=self.start_requested_software_instance.getReference(),
) )
self.assertEqual(expected_xml, got_xml, self.assertXMLEqual(expected_xml, got_xml)
'\n'.join([q for q in difflib.unified_diff(expected_xml.split('\n'), got_xml.split('\n'))]))
def test_getComputerPartitionStatus_visited(self): def test_getComputerPartitionStatus_visited(self):
self._makeComplexComputeNode(person=self.person) self._makeComplexComputeNode(person=self.person)
...@@ -2713,8 +2697,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin): ...@@ -2713,8 +2697,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
compute_node_id=self.compute_node_id, compute_node_id=self.compute_node_id,
partition_id=partition_id partition_id=partition_id
) )
self.assertEqual(expected_xml, got_xml, self.assertXMLEqual(expected_xml, got_xml)
'\n'.join([q for q in difflib.unified_diff(expected_xml.split('\n'), got_xml.split('\n'))]))
def test_registerComputerPartition_withSlave(self): def test_registerComputerPartition_withSlave(self):
self._makeComplexComputeNode(person=self.person, with_slave=True) self._makeComplexComputeNode(person=self.person, with_slave=True)
...@@ -2844,8 +2827,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin): ...@@ -2844,8 +2827,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
slave_1_instance_guid=self.start_requested_slave_instance.getReference(), slave_1_instance_guid=self.start_requested_slave_instance.getReference(),
slave_1_title=self.start_requested_slave_instance.getTitle(), slave_1_title=self.start_requested_slave_instance.getTitle(),
) )
self.assertEqual(expected_xml, got_xml, self.assertXMLEqual(expected_xml, got_xml)
'\n'.join([q for q in difflib.unified_diff(expected_xml.split('\n'), got_xml.split('\n'))]))
def test_registerComputerPartition(self): def test_registerComputerPartition(self):
self._makeComplexComputeNode(person=self.person) self._makeComplexComputeNode(person=self.person)
...@@ -2956,8 +2938,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin): ...@@ -2956,8 +2938,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
root_instance_title=self.start_requested_software_instance.getSpecialiseValue().getTitle(), root_instance_title=self.start_requested_software_instance.getSpecialiseValue().getTitle(),
software_type=self.start_requested_software_instance.getSourceReference() software_type=self.start_requested_software_instance.getSourceReference()
) )
self.assertEqual(expected_xml, got_xml, self.assertXMLEqual(expected_xml, got_xml)
'\n'.join([q for q in difflib.unified_diff(expected_xml.split('\n'), got_xml.split('\n'))]))
def assertInstanceBangSimulator(self, args, kwargs): def assertInstanceBangSimulator(self, args, kwargs):
stored = eval(open(self.instance_bang_simulator).read()) #pylint: disable=eval-used stored = eval(open(self.instance_bang_simulator).read()) #pylint: disable=eval-used
...@@ -3018,8 +2999,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin): ...@@ -3018,8 +2999,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
person_reference=self.person_reference, person_reference=self.person_reference,
instance_guid=self.start_requested_software_instance.getReference() instance_guid=self.start_requested_software_instance.getReference()
) )
self.assertEqual(expected_xml, got_xml, self.assertXMLEqual(expected_xml, got_xml)
'\n'.join([q for q in difflib.unified_diff(expected_xml.split('\n'), got_xml.split('\n'))]))
self.assertInstanceBangSimulator((), {'comment': error_log, 'bang_tree': True}) self.assertInstanceBangSimulator((), {'comment': error_log, 'bang_tree': True})
finally: finally:
if os.path.exists(self.instance_bang_simulator): if os.path.exists(self.instance_bang_simulator):
...@@ -3201,9 +3181,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin): ...@@ -3201,9 +3181,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
ip=self.start_requested_software_instance.getAggregateValue()\ ip=self.start_requested_software_instance.getAggregateValue()\
.getDefaultNetworkAddressIpAddress(), .getDefaultNetworkAddressIpAddress(),
) )
self.assertEqual(expected_xml, got_xml, self.assertXMLEqual(expected_xml, got_xml)
'\n'.join([q for q in difflib.unified_diff(expected_xml.split('\n'),
got_xml.split('\n'))]))
def assertSupplySimulator(self, args, kwargs): def assertSupplySimulator(self, args, kwargs):
stored = eval(open(self.compute_node_supply_simulator).read()) #pylint: disable=eval-used stored = eval(open(self.compute_node_supply_simulator).read()) #pylint: disable=eval-used
...@@ -3269,8 +3247,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin): ...@@ -3269,8 +3247,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
</marshal> </marshal>
""" % {'compute_node_id': compute_node_reference} """ % {'compute_node_id': compute_node_reference}
self.assertEqual(expected_xml, got_xml, self.assertXMLEqual(expected_xml, got_xml)
'\n'.join([q for q in difflib.unified_diff(expected_xml.split('\n'), got_xml.split('\n'))]))
self.assertRequestComputeNodeSimulator((), {'compute_node_title': compute_node_id}) self.assertRequestComputeNodeSimulator((), {'compute_node_title': compute_node_id})
finally: finally:
if os.path.exists(self.compute_node_request_compute_node_simulator): if os.path.exists(self.compute_node_request_compute_node_simulator):
...@@ -3310,8 +3287,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin): ...@@ -3310,8 +3287,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
</marshal> </marshal>
""" % {'compute_node_key': compute_node_key, 'compute_node_certificate': compute_node_certificate} """ % {'compute_node_key': compute_node_key, 'compute_node_certificate': compute_node_certificate}
self.assertEqual(expected_xml, got_xml, self.assertXMLEqual(expected_xml, got_xml)
'\n'.join([q for q in difflib.unified_diff(expected_xml.split('\n'), got_xml.split('\n'))]))
self.assertGenerateComputeNodeCertificateSimulator((), {}) self.assertGenerateComputeNodeCertificateSimulator((), {})
finally: finally:
if os.path.exists(self.generate_compute_node_certificate_simulator): if os.path.exists(self.generate_compute_node_certificate_simulator):
......
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