Commit 1963d1a2 authored by Gabriel Monnerat's avatar Gabriel Monnerat

use boolean asserts to validate True or False

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk/utils@42041 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f30a552f
...@@ -66,7 +66,7 @@ class TestFileSystemDocument(unittest.TestCase): ...@@ -66,7 +66,7 @@ class TestFileSystemDocument(unittest.TestCase):
self.fsdocument.restoreOriginal() self.fsdocument.restoreOriginal()
self.assertEquals(path.exists(old_document_url), False) self.assertEquals(path.exists(old_document_url), False)
self.assertNotEquals(old_document_url, self.fsdocument.getUrl()) self.assertNotEquals(old_document_url, self.fsdocument.getUrl())
self.assertEquals(path.exists(self.fsdocument.getUrl()), True) self.assertTrue(path.exists(self.fsdocument.getUrl()))
self.assertEquals(self.fsdocument.getContent(), self.data) self.assertEquals(self.fsdocument.getContent(), self.data)
def testgetContent(self): def testgetContent(self):
...@@ -76,7 +76,7 @@ class TestFileSystemDocument(unittest.TestCase): ...@@ -76,7 +76,7 @@ class TestFileSystemDocument(unittest.TestCase):
def testgetUrl(self): def testgetUrl(self):
"""Check if the url is correct""" """Check if the url is correct"""
url = self.fsdocument.getUrl() url = self.fsdocument.getUrl()
self.assertEquals(path.exists(url), True) self.assertTrue(path.exists(url))
def testLoadDocumentFile(self): def testLoadDocumentFile(self):
"""Test if the document is created correctly""" """Test if the document is created correctly"""
...@@ -126,7 +126,7 @@ class TestFileSystemDocument(unittest.TestCase): ...@@ -126,7 +126,7 @@ class TestFileSystemDocument(unittest.TestCase):
data = open(zip_input_url).read() data = open(zip_input_url).read()
zipdocument = FileSystemDocument(self.tmp_url, data, 'zip') zipdocument = FileSystemDocument(self.tmp_url, data, 'zip')
open(zip_output_url, 'w').write(zipdocument.getContent(True)) open(zip_output_url, 'w').write(zipdocument.getContent(True))
self.assertEquals(is_zipfile(zip_output_url), True) self.assertTrue(is_zipfile(zip_output_url))
zipfile = ZipFile(zip_output_url) zipfile = ZipFile(zip_output_url)
self.assertEquals(sorted(zipfile.namelist()), self.assertEquals(sorted(zipfile.namelist()),
sorted(['logo.gif', 'test.htm'])) sorted(['logo.gif', 'test.htm']))
......
...@@ -51,7 +51,7 @@ class TestFilter(unittest.TestCase): ...@@ -51,7 +51,7 @@ class TestFilter(unittest.TestCase):
self.assertEquals(self.filter.getName(), 'writer_pdf_Export') self.assertEquals(self.filter.getName(), 'writer_pdf_Export')
self.assertEquals(self.filter.getMimetype(), 'application/pdf') self.assertEquals(self.filter.getMimetype(), 'application/pdf')
self.assertEquals(self.filter.getSortIndex(), 1000) self.assertEquals(self.filter.getSortIndex(), 1000)
self.assertEquals(self.filter.isPreferred(), True) self.assertTrue(self.filter.isPreferred())
def test_suite(): def test_suite():
......
...@@ -55,7 +55,7 @@ class TestInterface(unittest.TestCase): ...@@ -55,7 +55,7 @@ class TestInterface(unittest.TestCase):
def testITableGranulator(self): def testITableGranulator(self):
"""Test if OOGranulator implements ITableGranulator""" """Test if OOGranulator implements ITableGranulator"""
self.assertEquals(ITableGranulator.implementedBy(OOGranulator), True) self.assertTrue(ITableGranulator.implementedBy(OOGranulator))
method_list = ['getLineItemList', method_list = ['getLineItemList',
'getTableItem', 'getTableItem',
'getTableItemList', 'getTableItemList',
...@@ -65,7 +65,7 @@ class TestInterface(unittest.TestCase): ...@@ -65,7 +65,7 @@ class TestInterface(unittest.TestCase):
def testITextGranulator(self): def testITextGranulator(self):
"""Test if OOGranulator implements ITextGranulator""" """Test if OOGranulator implements ITextGranulator"""
self.assertEquals(ITextGranulator.implementedBy(OOGranulator), True) self.assertTrue(ITextGranulator.implementedBy(OOGranulator))
method_list = ['getChapterItemList', method_list = ['getChapterItemList',
'getParagraphItem', 'getParagraphItem',
'getChapterItem', 'getChapterItem',
...@@ -74,17 +74,17 @@ class TestInterface(unittest.TestCase): ...@@ -74,17 +74,17 @@ class TestInterface(unittest.TestCase):
def testIImageGranulator(self): def testIImageGranulator(self):
"""Test if OOGranulator implements IImageGranulator""" """Test if OOGranulator implements IImageGranulator"""
self.assertEquals(IImageGranulator.implementedBy(OOGranulator), True) self.assertTrue(IImageGranulator.implementedBy(OOGranulator))
method_list = ['getImageItemList', 'getImage'] method_list = ['getImageItemList', 'getImage']
self.assertEquals(IImageGranulator.names(), method_list) self.assertEquals(IImageGranulator.names(), method_list)
def testIDocument(self): def testIDocument(self):
"""Test if FileSystemDocument implements IDocument""" """Test if FileSystemDocument implements IDocument"""
self.assertEquals(IDocument.implementedBy(FileSystemDocument), True) self.assertTrue(IDocument.implementedBy(FileSystemDocument))
def testIOdfDocument(self): def testIOdfDocument(self):
"""Test if OdfDocument implements IOdfDocument""" """Test if OdfDocument implements IOdfDocument"""
self.assertEquals(IOdfDocument.implementedBy(OdfDocument), True) self.assertTrue(IOdfDocument.implementedBy(OdfDocument))
method_list = ['getContentXml', method_list = ['getContentXml',
'parsed_content', 'parsed_content',
'source_format', 'source_format',
...@@ -93,13 +93,13 @@ class TestInterface(unittest.TestCase): ...@@ -93,13 +93,13 @@ class TestInterface(unittest.TestCase):
def testIFilter(self): def testIFilter(self):
"""Test if Filter implements IDocument""" """Test if Filter implements IDocument"""
self.assertEquals(IFilter.implementedBy(Filter), True) self.assertTrue(IFilter.implementedBy(Filter))
self.assertEquals(IFilter.names(), ['getLabel', 'getName', 'getSortIndex', self.assertEquals(IFilter.names(), ['getLabel', 'getName', 'getSortIndex',
'isPreferred', 'getDocumentService', 'getExtension', 'getMimetype']) 'isPreferred', 'getDocumentService', 'getExtension', 'getMimetype'])
def testIManager(self): def testIManager(self):
"""Test if Manager implements IManager""" """Test if Manager implements IManager"""
self.assertEquals(IManager.implementedBy(Manager), True) self.assertTrue(IManager.implementedBy(Manager))
method_list = ['convertFile', method_list = ['convertFile',
'getFileMetadataItemList', 'getFileMetadataItemList',
'updateFileMetadata', 'updateFileMetadata',
...@@ -107,7 +107,7 @@ class TestInterface(unittest.TestCase): ...@@ -107,7 +107,7 @@ class TestInterface(unittest.TestCase):
'granulateFile'] 'granulateFile']
for method in method_list: for method in method_list:
self.assertEquals(method in IManager.names(), True) self.assertTrue(method in IManager.names())
self.assertEquals(len(method_list), len(IManager.names())) self.assertEquals(len(method_list), len(IManager.names()))
self.assertEquals(IManager.get('convertFile').required, ('file', self.assertEquals(IManager.get('convertFile').required, ('file',
...@@ -125,9 +125,9 @@ class TestInterface(unittest.TestCase): ...@@ -125,9 +125,9 @@ class TestInterface(unittest.TestCase):
'getFilterList', 'getAllowedExtensionList', 'getMimetypeByFilterType', 'getFilterList', 'getAllowedExtensionList', 'getMimetypeByFilterType',
'isLoaded'] 'isLoaded']
for method in method_list: for method in method_list:
self.assertEquals(method in IMimemapper.names(), True) self.assertTrue(method in IMimemapper.names())
self.assertEquals(IMimemapper.implementedBy(MimeMapper), True) self.assertTrue(IMimemapper.implementedBy(MimeMapper))
self.assertEquals(len(method_list), len(IMimemapper.names())) self.assertEquals(len(method_list), len(IMimemapper.names()))
self.assertEquals(IMimemapper.get('getFilterName').required, self.assertEquals(IMimemapper.get('getFilterName').required,
('extension', 'document_type')) ('extension', 'document_type'))
...@@ -141,16 +141,16 @@ class TestInterface(unittest.TestCase): ...@@ -141,16 +141,16 @@ class TestInterface(unittest.TestCase):
def testIMonitor(self): def testIMonitor(self):
"""Test if Monitors implements IMonitor""" """Test if Monitors implements IMonitor"""
self.assertEquals(IMonitor.implementedBy(MonitorRequest), True) self.assertTrue(IMonitor.implementedBy(MonitorRequest))
self.assertEquals(IMonitor.names(), ["run"]) self.assertEquals(IMonitor.names(), ["run"])
def testIHandler(self): def testIHandler(self):
"""Test if Handlers implements IHandler""" """Test if Handlers implements IHandler"""
self.assertEquals(IHandler.implementedBy(OOHandler), True) self.assertTrue(IHandler.implementedBy(OOHandler))
method_list = ['convert', 'getMetadata', 'setMetadata'] method_list = ['convert', 'getMetadata', 'setMetadata']
for method in method_list: for method in method_list:
self.assertEquals(method in IHandler.names(), True, self.assertTrue(method in IHandler.names(),
"Method %s is not declared" % method) "Method %s is not declared" % method)
self.assertEquals(len(method_list), len(IHandler.names())) self.assertEquals(len(method_list), len(IHandler.names()))
self.assertEquals(IHandler.get('convert').required, ('destination_format',)) self.assertEquals(IHandler.get('convert').required, ('destination_format',))
self.assertEquals(IHandler.get('getMetadata').required, self.assertEquals(IHandler.get('getMetadata').required,
...@@ -160,8 +160,8 @@ class TestInterface(unittest.TestCase): ...@@ -160,8 +160,8 @@ class TestInterface(unittest.TestCase):
def testIApplication(self): def testIApplication(self):
"""Test if OpenOffice implements IApplication""" """Test if OpenOffice implements IApplication"""
self.assertEquals(IApplication.implementedBy(OpenOffice), True) self.assertTrue(IApplication.implementedBy(OpenOffice))
self.assertEquals(IApplication.implementedBy(Xvfb), True) self.assertTrue(IApplication.implementedBy(Xvfb))
application_method_list = ["start", "stop", "pid", application_method_list = ["start", "stop", "pid",
"status", "restart", "status", "restart",
"loadSettings", "getAddress"] "loadSettings", "getAddress"]
...@@ -170,7 +170,7 @@ class TestInterface(unittest.TestCase): ...@@ -170,7 +170,7 @@ class TestInterface(unittest.TestCase):
def testILockable(self): def testILockable(self):
"""Test if Openoffice implements ILockable""" """Test if Openoffice implements ILockable"""
self.assertEquals(ILockable.implementedBy(OpenOffice), True) self.assertTrue(ILockable.implementedBy(OpenOffice))
lockable_method_list = ["_lock", "acquire", "release", "isLocked"] lockable_method_list = ["_lock", "acquire", "release", "isLocked"]
self.assertEquals(sorted(ILockable.names()), sorted(lockable_method_list)) self.assertEquals(sorted(ILockable.names()), sorted(lockable_method_list))
......
...@@ -60,7 +60,7 @@ class TestMonitorMemory(unittest.TestCase): ...@@ -60,7 +60,7 @@ class TestMonitorMemory(unittest.TestCase):
self.monitor = MonitorMemory(openoffice, 1, 1000) self.monitor = MonitorMemory(openoffice, 1, 1000)
self.monitor.start() self.monitor.start()
sleep(6) sleep(6)
self.assertEquals(openoffice.status(), True) self.assertTrue(openoffice.status())
finally: finally:
self.monitor.terminate() self.monitor.terminate()
...@@ -82,7 +82,7 @@ class TestMonitorMemory(unittest.TestCase): ...@@ -82,7 +82,7 @@ class TestMonitorMemory(unittest.TestCase):
self.monitor.start() self.monitor.start()
try: try:
sleep(self.interval) sleep(self.interval)
self.assertEquals(self.monitor.is_alive(), True) self.assertTrue(self.monitor.is_alive())
finally: finally:
self.monitor.terminate() self.monitor.terminate()
...@@ -90,7 +90,7 @@ class TestMonitorMemory(unittest.TestCase): ...@@ -90,7 +90,7 @@ class TestMonitorMemory(unittest.TestCase):
"""Test if the psutil.Process is create correctly""" """Test if the psutil.Process is create correctly"""
self.monitor = MonitorMemory(openoffice, 2, 1000) self.monitor = MonitorMemory(openoffice, 2, 1000)
self.monitor.create_process() self.monitor.create_process()
self.assertEquals(hasattr(self.monitor, 'process'), True) self.assertTrue(hasattr(self.monitor, 'process'))
self.assertEquals(type(self.monitor.process), Process) self.assertEquals(type(self.monitor.process), Process)
def testGetMemoryUsage(self): def testGetMemoryUsage(self):
......
...@@ -40,7 +40,7 @@ class TestMonitorRequest(cloudoooTestCase): ...@@ -40,7 +40,7 @@ class TestMonitorRequest(cloudoooTestCase):
"""Test terminate function to stop the thread""" """Test terminate function to stop the thread"""
monitor_request = MonitorRequest(openoffice, 0, 2) monitor_request = MonitorRequest(openoffice, 0, 2)
monitor_request.start() monitor_request.start()
self.assertEquals(monitor_request.is_alive(), True) self.assertTrue(monitor_request.is_alive())
monitor_request.terminate() monitor_request.terminate()
sleep(4) sleep(4)
try: try:
......
...@@ -44,7 +44,7 @@ class TestMonitorTimeout(unittest.TestCase): ...@@ -44,7 +44,7 @@ class TestMonitorTimeout(unittest.TestCase):
"""Test if the monitor of memory works""" """Test if the monitor of memory works"""
monitor_timeout = self._createMonitor(10) monitor_timeout = self._createMonitor(10)
monitor_timeout.start() monitor_timeout.start()
self.assertEquals(monitor_timeout.is_alive(), True) self.assertTrue(monitor_timeout.is_alive())
monitor_timeout.terminate() monitor_timeout.terminate()
monitor_timeout = self._createMonitor(1) monitor_timeout = self._createMonitor(1)
monitor_timeout.start() monitor_timeout.start()
...@@ -61,7 +61,7 @@ class TestMonitorTimeout(unittest.TestCase): ...@@ -61,7 +61,7 @@ class TestMonitorTimeout(unittest.TestCase):
sleep(2) sleep(2)
self.assertEquals(openoffice.status(), False) self.assertEquals(openoffice.status(), False)
openoffice.restart() openoffice.restart()
self.assertEquals(openoffice.status(), True) self.assertTrue(openoffice.status())
finally: finally:
monitor_timeout.terminate() monitor_timeout.terminate()
openoffice.release() openoffice.release()
...@@ -76,7 +76,7 @@ class TestMonitorTimeout(unittest.TestCase): ...@@ -76,7 +76,7 @@ class TestMonitorTimeout(unittest.TestCase):
self.assertEquals(openoffice.status(), False) self.assertEquals(openoffice.status(), False)
monitor_timeout.terminate() monitor_timeout.terminate()
openoffice.restart() openoffice.restart()
self.assertEquals(openoffice.status(), True) self.assertTrue(openoffice.status())
monitor_timeout = self._createMonitor(1) monitor_timeout = self._createMonitor(1)
monitor_timeout.start() monitor_timeout.start()
sleep(2) sleep(2)
......
...@@ -102,7 +102,7 @@ class TestOOHandler(cloudoooTestCase): ...@@ -102,7 +102,7 @@ class TestOOHandler(cloudoooTestCase):
'odt') 'odt')
metadata = handler.getMetadata() metadata = handler.getMetadata()
self.assertEquals(metadata.get('Data'), '') self.assertEquals(metadata.get('Data'), '')
self.assertEquals(metadata.has_key('Data'), True) self.assertTrue(metadata.has_key('Data'))
self.assertEquals(metadata.get('MIMEType'), self.assertEquals(metadata.get('MIMEType'),
'application/vnd.oasis.opendocument.text') 'application/vnd.oasis.opendocument.text')
handler.document.restoreOriginal() handler.document.restoreOriginal()
......
...@@ -31,7 +31,6 @@ from cloudoooTestCase import cloudoooTestCase ...@@ -31,7 +31,6 @@ from cloudoooTestCase import cloudoooTestCase
from cloudooo.handler.ooo.application.openoffice import OpenOffice from cloudooo.handler.ooo.application.openoffice import OpenOffice
from cloudoooTestCase import make_suite from cloudoooTestCase import make_suite
from cloudooo.handler.ooo.utils.utils import waitStopDaemon from cloudooo.handler.ooo.utils.utils import waitStopDaemon
from psutil import Process, AccessDenied
class TestOpenOffice(cloudoooTestCase): class TestOpenOffice(cloudoooTestCase):
...@@ -62,7 +61,7 @@ class TestOpenOffice(cloudoooTestCase): ...@@ -62,7 +61,7 @@ class TestOpenOffice(cloudoooTestCase):
def testOpenOfficeStart(self): def testOpenOfficeStart(self):
"""Test if the start method works correclty""" """Test if the start method works correclty"""
self.assertEquals(self.openoffice.status(), True) self.assertTrue(self.openoffice.status())
def testOpenOfficeStop(self): def testOpenOfficeStop(self):
"""Test if the stop method works correctly""" """Test if the stop method works correctly"""
...@@ -79,12 +78,12 @@ class TestOpenOffice(cloudoooTestCase): ...@@ -79,12 +78,12 @@ class TestOpenOffice(cloudoooTestCase):
def testOpenOfficeRestart(self): def testOpenOfficeRestart(self):
"""Test if the method restart works correctly""" """Test if the method restart works correctly"""
self.openoffice.restart() self.openoffice.restart()
self.assertEquals(self.openoffice.status(), True) self.assertTrue(self.openoffice.status())
def testOpenOfficeLock(self): def testOpenOfficeLock(self):
"""Test lock and unlock""" """Test lock and unlock"""
self.openoffice.acquire() self.openoffice.acquire()
self.assertEquals(self.openoffice.isLocked(), True) self.assertTrue(self.openoffice.isLocked())
self.openoffice.release() self.openoffice.release()
self.assertEquals(self.openoffice.isLocked(), False) self.assertEquals(self.openoffice.isLocked(), False)
...@@ -100,7 +99,7 @@ class TestOpenOffice(cloudoooTestCase): ...@@ -100,7 +99,7 @@ class TestOpenOffice(cloudoooTestCase):
'en') 'en')
second_openoffice.start() second_openoffice.start()
self.assertEquals(self.openoffice.status(), False) self.assertEquals(self.openoffice.status(), False)
self.assertEquals(second_openoffice.status(), True) self.assertTrue(second_openoffice.status())
second_openoffice.stop() second_openoffice.stop()
self.openoffice.start() self.openoffice.start()
...@@ -112,8 +111,8 @@ class TestOpenOffice(cloudoooTestCase): ...@@ -112,8 +111,8 @@ class TestOpenOffice(cloudoooTestCase):
self.uno_path, self.uno_path,
'en') 'en')
second_openoffice.start() second_openoffice.start()
self.assertEquals(self.openoffice.status(), True) self.assertTrue(self.openoffice.status())
self.assertEquals(second_openoffice.status(), True) self.assertTrue(second_openoffice.status())
def test_suite(): def test_suite():
......
...@@ -278,7 +278,7 @@ class TestServer(cloudoooTestCase): ...@@ -278,7 +278,7 @@ class TestServer(cloudoooTestCase):
'txt', 'txt',
'ASCII text\n') 'ASCII text\n')
self.assertEquals(open(output_url).read().endswith('cloudooo Test\n \n'), True) self.assertTrue(open(output_url).read().endswith('cloudooo Test\n \n'))
def testConvertPNGToSVG(self): def testConvertPNGToSVG(self):
"""Test export png to svg""" """Test export png to svg"""
...@@ -323,8 +323,8 @@ class TestServer(cloudoooTestCase): ...@@ -323,8 +323,8 @@ class TestServer(cloudoooTestCase):
self.fail(fail_msg) self.fail(fail_msg)
except Fault, err: except Fault, err:
msg = "This format is not supported or is invalid" msg = "This format is not supported or is invalid"
self.assertEquals(err.faultString.endswith(msg), True, self.assertTrue(err.faultString.endswith(msg),
"ConvertFile\n" + err.faultString) "ConvertFile\n" + err.faultString)
res = self.proxy.getFileMetadataItemList(data, '') res = self.proxy.getFileMetadataItemList(data, '')
self.assertEquals(res['MIMEType'], "text/plain") self.assertEquals(res['MIMEType'], "text/plain")
...@@ -341,8 +341,8 @@ class TestServer(cloudoooTestCase): ...@@ -341,8 +341,8 @@ class TestServer(cloudoooTestCase):
self.fail("") self.fail("")
except Fault, err: except Fault, err:
err_str = err.faultString err_str = err.faultString
self.assertEquals(err_str.endswith(error_msg), True, self.assertTrue(err_str.endswith(error_msg),
"%s\n%s" % (error_msg, err_str)) "%s\n%s" % (error_msg, err_str))
def testConvertDocumentToImpossibleFormat(self): def testConvertDocumentToImpossibleFormat(self):
"""Try convert one document to format not possible""" """Try convert one document to format not possible"""
...@@ -352,7 +352,7 @@ class TestServer(cloudoooTestCase): ...@@ -352,7 +352,7 @@ class TestServer(cloudoooTestCase):
self.fail("") self.fail("")
except Fault, err: except Fault, err:
err_str = err.faultString err_str = err.faultString
self.assertEquals(err_str.endswith("ErrorCodeIOException\n"), True) self.assertTrue(err_str.endswith("ErrorCodeIOException\n"))
def testRunConvertMethod(self): def testRunConvertMethod(self):
"""Test run_convert method""" """Test run_convert method"""
...@@ -439,7 +439,7 @@ class TestServer(cloudoooTestCase): ...@@ -439,7 +439,7 @@ class TestServer(cloudoooTestCase):
zipfile.extractall(self.tmp_url) zipfile.extractall(self.tmp_url)
stdout, stderr = Popen("file -b %s" % png_path, shell=True, stdout, stderr = Popen("file -b %s" % png_path, shell=True,
stdout=PIPE).communicate() stdout=PIPE).communicate()
self.assertEquals(stdout.startswith('PNG image data'), True, stdout) self.assertTrue(stdout.startswith('PNG image data'), stdout)
self.assertTrue("8-bit/color RGB" in stdout, stdout) self.assertTrue("8-bit/color RGB" in stdout, stdout)
finally: finally:
zipfile.close() zipfile.close()
...@@ -479,7 +479,7 @@ class TestServer(cloudoooTestCase): ...@@ -479,7 +479,7 @@ class TestServer(cloudoooTestCase):
self.assertEquals(response_code, 402) self.assertEquals(response_code, 402)
self.assertEquals(type(response_dict), DictType) self.assertEquals(type(response_dict), DictType)
self.assertEquals(response_dict, {}) self.assertEquals(response_dict, {})
self.assertEquals(response_message.startswith('Traceback'), True) self.assertTrue(response_message.startswith('Traceback'))
def testRunSetMetadata(self): def testRunSetMetadata(self):
"""Test run_setmetadata method""" """Test run_setmetadata method"""
...@@ -518,7 +518,7 @@ class TestServer(cloudoooTestCase): ...@@ -518,7 +518,7 @@ class TestServer(cloudoooTestCase):
response_code, response_dict, response_message = setmetadata_result response_code, response_dict, response_message = setmetadata_result
self.assertEquals(response_code, 402) self.assertEquals(response_code, 402)
self.assertEquals(response_dict, {}) self.assertEquals(response_dict, {})
self.assertEquals(response_message.startswith('Traceback'), True) self.assertTrue(response_message.startswith('Traceback'))
def testGetAllowedTargetItemList(self): def testGetAllowedTargetItemList(self):
"""Test if filter name returns correctly with ERP5 API""" """Test if filter name returns correctly with ERP5 API"""
......
...@@ -77,7 +77,7 @@ class TestUnoConverter(cloudoooTestCase): ...@@ -77,7 +77,7 @@ class TestUnoConverter(cloudoooTestCase):
stdout=PIPE, stderr=PIPE).communicate() stdout=PIPE, stderr=PIPE).communicate()
self.assertEquals(stderr, '') self.assertEquals(stderr, '')
output_url = stdout.replace('\n', '') output_url = stdout.replace('\n', '')
self.assertEquals(exists(output_url), True, stdout) self.assertTrue(exists(output_url), stdout)
stdout, stderr = Popen("file %s" % output_url, shell=True, stdout, stderr = Popen("file %s" % output_url, shell=True,
stdout=PIPE, stderr=PIPE).communicate() stdout=PIPE, stderr=PIPE).communicate()
self.assertEquals(self.file_msg_list[1] in stdout \ self.assertEquals(self.file_msg_list[1] in stdout \
......
...@@ -65,8 +65,8 @@ class TestUnoMimeMapper(cloudoooTestCase): ...@@ -65,8 +65,8 @@ class TestUnoMimeMapper(cloudoooTestCase):
stdout=PIPE, stderr=PIPE).communicate() stdout=PIPE, stderr=PIPE).communicate()
self.assertEquals(stderr, '') self.assertEquals(stderr, '')
filter_dict, type_dict = json.loads(stdout) filter_dict, type_dict = json.loads(stdout)
self.assertEquals('filter_dict' in locals(), True) self.assertTrue('filter_dict' in locals())
self.assertEquals('type_dict' in locals(), True) self.assertTrue('type_dict' in locals())
self.assertNotEquals(filter_dict.get('writer8'), None) self.assertNotEquals(filter_dict.get('writer8'), None)
self.assertEquals(type_dict.get('writer8').get('Name'), 'writer8') self.assertEquals(type_dict.get('writer8').get('Name'), 'writer8')
self.assertNotEquals(filter_dict.get('writer8'), None) self.assertNotEquals(filter_dict.get('writer8'), None)
...@@ -85,8 +85,8 @@ class TestUnoMimeMapper(cloudoooTestCase): ...@@ -85,8 +85,8 @@ class TestUnoMimeMapper(cloudoooTestCase):
stdout=PIPE, stderr=PIPE).communicate() stdout=PIPE, stderr=PIPE).communicate()
self.assertEquals(stderr, '') self.assertEquals(stderr, '')
filter_dict, type_dict = json.loads(stdout) filter_dict, type_dict = json.loads(stdout)
self.assertEquals('filter_dict' in locals(), True) self.assertTrue('filter_dict' in locals())
self.assertEquals('type_dict' in locals(), True) self.assertTrue('type_dict' in locals())
self.assertNotEquals(filter_dict.get('writer8'), None) self.assertNotEquals(filter_dict.get('writer8'), None)
self.assertEquals(type_dict.get('writer8').get('Name'), 'writer8') self.assertEquals(type_dict.get('writer8').get('Name'), 'writer8')
self.assertNotEquals(filter_dict.get('writer8'), None) self.assertNotEquals(filter_dict.get('writer8'), None)
...@@ -109,7 +109,7 @@ class TestUnoMimeMapper(cloudoooTestCase): ...@@ -109,7 +109,7 @@ class TestUnoMimeMapper(cloudoooTestCase):
stdout, stderr = Popen(' '.join(command), shell=True, stdout, stderr = Popen(' '.join(command), shell=True,
stdout=PIPE, stderr=PIPE).communicate() stdout=PIPE, stderr=PIPE).communicate()
self.assertEquals(stdout, '') self.assertEquals(stdout, '')
self.assertEquals(stderr.endswith(error_msg), True, stderr) self.assertTrue(stderr.endswith(error_msg), stderr)
openoffice.start() openoffice.start()
......
...@@ -47,9 +47,9 @@ class TestUtils(unittest.TestCase): ...@@ -47,9 +47,9 @@ class TestUtils(unittest.TestCase):
def testConversion(self): def testConversion(self):
"""Test convertion to bool""" """Test convertion to bool"""
self.assertEquals(convertStringToBool('true'), True) self.assertTrue(convertStringToBool('true'))
self.assertEquals(convertStringToBool('false'), False) self.assertEquals(convertStringToBool('false'), False)
self.assertEquals(convertStringToBool('truE'), True) self.assertTrue(convertStringToBool('truE'))
self.assertEquals(convertStringToBool('faLse'), False) self.assertEquals(convertStringToBool('faLse'), False)
self.assertEquals(convertStringToBool(''), None) self.assertEquals(convertStringToBool(''), None)
......
...@@ -48,21 +48,21 @@ class TestXvfb(cloudoooTestCase): ...@@ -48,21 +48,21 @@ class TestXvfb(cloudoooTestCase):
self.assertEquals(self.xvfb.pid(), None) self.assertEquals(self.xvfb.pid(), None)
self.xvfb.start() self.xvfb.start()
self.assertNotEquals(self.xvfb.pid(), None) self.assertNotEquals(self.xvfb.pid(), None)
self.assertEquals(self.xvfb.status(), True) self.assertTrue(self.xvfb.status())
self.xvfb.stop() self.xvfb.stop()
self.assertNotEquals(self.xvfb.pid(), None) self.assertNotEquals(self.xvfb.pid(), None)
self.assertEquals(self.xvfb.status(), False) self.assertEquals(self.xvfb.status(), False)
def testStatus(self): def testStatus(self):
"""Test if xvfb is started and stopped correctly""" """Test if xvfb is started and stopped correctly"""
self.assertEquals(self.xvfb.status(), False) self.assertFalse(self.xvfb.status())
try: try:
self.xvfb.start() self.xvfb.start()
self.assertEquals(self.xvfb.status(), True) self.assertTrue(self.xvfb.status())
finally: finally:
self.xvfb.stop() self.xvfb.stop()
waitStopDaemon(self.xvfb) waitStopDaemon(self.xvfb)
self.assertEquals(self.xvfb.status(), False) self.assertFalse(self.xvfb.status())
def test_suite(): def test_suite():
......
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