Commit 0af82759 authored by Gabriel Monnerat's avatar Gabriel Monnerat

clean up code and asserts

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk/utils@41883 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 242486d5
...@@ -92,18 +92,14 @@ class TestOpenOffice(cloudoooTestCase): ...@@ -92,18 +92,14 @@ class TestOpenOffice(cloudoooTestCase):
openoffice will terminate the first""" openoffice will terminate the first"""
second_openoffice = OpenOffice() second_openoffice = OpenOffice()
second_openoffice.loadSettings("localhost", 4090, second_openoffice.loadSettings("localhost", 4090,
self.working_path, self.working_path + "_",
self.virtual_display_id, self.virtual_display_id,
self.office_binary_path, self.office_binary_path,
self.uno_path) self.uno_path)
try: try:
second_openoffice.start() second_openoffice.start()
try:
openoffice_process = Process(self.openoffice.pid()) openoffice_process = Process(self.openoffice.pid())
openoffice_process.get_connections() self.assertRaises(AccessDenied, openoffice_process.get_connections)
self.fail("Access get_connections() function should fails")
except AccessDenied:
self.assertTrue("Excepted failure")
finally: finally:
second_openoffice.stop() second_openoffice.stop()
...@@ -116,15 +112,12 @@ class TestOpenOffice(cloudoooTestCase): ...@@ -116,15 +112,12 @@ class TestOpenOffice(cloudoooTestCase):
self.uno_path) self.uno_path)
try: try:
second_openoffice.start() second_openoffice.start()
try:
openoffice_process = Process(self.openoffice.pid()) openoffice_process = Process(self.openoffice.pid())
connection = openoffice_process.get_connections()[0] connection = openoffice_process.get_connections()[0]
self.assertEquals(connection.local_address[1], 4090) self.assertEquals(connection.local_address[1], 4090)
openoffice_process = Process(second_openoffice.pid()) openoffice_process = Process(second_openoffice.pid())
connection = openoffice_process.get_connections()[0] connection = openoffice_process.get_connections()[0]
self.assertEquals(connection.local_address[1], 4091) self.assertEquals(connection.local_address[1], 4091)
except AccessDenied:
self.fail("Access get_connections() function should be allowed")
finally: finally:
second_openoffice.stop() second_openoffice.stop()
...@@ -147,15 +140,11 @@ class TestOpenOffice(cloudoooTestCase): ...@@ -147,15 +140,11 @@ class TestOpenOffice(cloudoooTestCase):
try: try:
third_openoffice.start() third_openoffice.start()
try:
openoffice_process = Process(self.openoffice.pid()) openoffice_process = Process(self.openoffice.pid())
connection = openoffice_process.get_connections()[0] connection = openoffice_process.get_connections()[0]
self.assertEquals(connection.local_address[1], 4090) self.assertEquals(connection.local_address[1], 4090)
openoffice_process = Process(second_openoffice.pid()) openoffice_process = Process(second_openoffice.pid())
openoffice_process.get_connections() self.assertRaises(AccessDenied, openoffice_process.get_connections)
self.fail("Access get_connections() function should fails")
except AccessDenied:
self.assertTrue("Excepted failure")
finally: finally:
second_openoffice.stop() second_openoffice.stop()
third_openoffice.stop() third_openoffice.stop()
......
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