Exemple #1
0
 def testConvertWithOpenOfficeStopped(self):
     """Test convert with openoffice stopped"""
     openoffice.stop()
     data = encodestring(open("data/test.doc").read())
     handler = Handler(self.tmp_url, decodestring(data), "doc")
     doc_exported = handler.convert("odt")
     self._assert_document_output(doc_exported, "application/vnd.oasis.opendocument.text")
 def testConvertWithOpenOfficeStopped(self):
     """Test convert with openoffice stopped"""
     openoffice.stop()
     data = encodestring(open("data/test.doc").read())
     handler = Handler(self.tmp_url, decodestring(data), 'doc')
     doc_exported = handler.convert("odt")
     self._assert_document_output(
         doc_exported, "application/vnd.oasis.opendocument.text")
Exemple #3
0
 def testGetMetadataWithOpenOfficeStopped(self):
     """Test getMetadata with openoffice stopped"""
     openoffice.stop()
     data = encodestring(open("data/test.odt").read())
     handler = Handler(self.tmp_url, decodestring(data), "odt")
     metadata = handler.getMetadata()
     self.assertEquals(metadata.get("Title"), "title")
     self.assertEquals(metadata.get("MIMEType"), "application/vnd.oasis.opendocument.text")
 def testSetMetadataWithOpenOfficeStopped(self):
     """Test setMetadata with openoffice stopped"""
     openoffice.stop()
     data = encodestring(open("data/test.doc").read())
     handler = Handler(self.tmp_url, decodestring(data), 'doc')
     new_data = handler.setMetadata({"Title": "cloudooo Test -"})
     new_handler = Handler(self.tmp_url, new_data, 'doc')
     metadata = new_handler.getMetadata()
     self.assertEquals(metadata.get('Title'), "cloudooo Test -")
 def testGetMetadataWithOpenOfficeStopped(self):
     """Test getMetadata with openoffice stopped"""
     openoffice.stop()
     data = encodestring(open("data/test.odt").read())
     handler = Handler(self.tmp_url, decodestring(data), 'odt')
     metadata = handler.getMetadata()
     self.assertEquals(metadata.get('Title'), 'title')
     self.assertEquals(metadata.get('MIMEType'),
                       'application/vnd.oasis.opendocument.text')
Exemple #6
0
 def testSetMetadataWithOpenOfficeStopped(self):
     """Test setMetadata with openoffice stopped"""
     openoffice.stop()
     data = encodestring(open("data/test.doc").read())
     handler = Handler(self.tmp_url, decodestring(data), "doc")
     new_data = handler.setMetadata({"Title": "cloudooo Test -"})
     new_handler = Handler(self.tmp_url, new_data, "doc")
     metadata = new_handler.getMetadata()
     self.assertEquals(metadata.get("Title"), "cloudooo Test -")
 def testGetMemoryUsage(self):
   """Test memory usage"""
   self.monitor = MonitorMemory(openoffice, 2, 400)
   openoffice.stop()
   memory_usage_int = self.monitor.get_memory_usage()
   self.assertEquals(memory_usage_int, 0)
   if not openoffice.status():
     openoffice.start()
   memory_usage_int = self.monitor.get_memory_usage()
   self.assertEquals(type(memory_usage_int), IntType)
 def testMonitorWithOpenOfficeStopped(self):
   """Tests if the monitor continues to run even with openoffice stopped"""
   openoffice.stop()
   self.monitor = MonitorMemory(openoffice, 2, 400)
   self.monitor.start()
   try:
     sleep(self.interval)
     self.assertTrue(self.monitor.is_alive())
   finally:
     self.monitor.terminate()
 def testGetMemoryUsage(self):
   """Test memory usage"""
   self.monitor = MonitorMemory(openoffice, 2, 400)
   openoffice.stop()
   memory_usage_int = self.monitor.get_memory_usage()
   self.assertEquals(memory_usage_int, 0)
   if not openoffice.status():
     openoffice.start()
   memory_usage_int = self.monitor.get_memory_usage()
   self.assertEquals(type(memory_usage_int), IntType)
 def testMonitorWithOpenOfficeStopped(self):
   """Tests if the monitor continues to run even with openoffice stopped"""
   openoffice.stop()
   self.monitor = MonitorMemory(openoffice, 2, 400)
   self.monitor.start()
   try:
     sleep(self.interval)
     self.assertTrue(self.monitor.is_alive())
   finally:
     self.monitor.terminate()
 def testWithoutOpenOffice(self):
   """Test when the openoffice is stopped"""
   error_msg = "couldn\'t connect to socket (Success)\n"
   hostname, host = openoffice.getAddress()
   openoffice.stop()
   python = path.join(self.office_binary_path, "python")
   command = [path.exists(python) and python or "python",
           pkg_resources.resource_filename(self.package_namespace,
                                           "/helper/unomimemapper.py"),
           "--uno_path=%s" % self.uno_path,
           "--office_binary_path=%s" % self.office_binary_path,
           "--hostname=%s" % self.hostname,
           "--port=%s" % self.openoffice_port]
   stdout, stderr = Popen(command,
                          stdout=PIPE,
                          stderr=PIPE).communicate()
   self.assertEquals(stdout, '')
   self.assertTrue(stderr.endswith(error_msg), stderr)
   openoffice.start()
Exemple #12
0
 def testWithoutOpenOffice(self):
     """Test when the openoffice is stopped"""
     error_msg = "couldn\'t connect to socket (Success)\n"
     hostname, host = openoffice.getAddress()
     openoffice.stop()
     python = path.join(self.office_binary_path, "python")
     command = [
         path.exists(python) and python or "python",
         pkg_resources.resource_filename(self.package_namespace,
                                         "/helper/unomimemapper.py"),
         "--uno_path=%s" % self.uno_path,
         "--office_binary_path=%s" % self.office_binary_path,
         "--hostname=%s" % self.hostname,
         "--port=%s" % self.openoffice_port
     ]
     stdout, stderr = Popen(command, stdout=PIPE, stderr=PIPE).communicate()
     self.assertEquals(stdout, '')
     self.assertTrue(stderr.endswith(error_msg), stderr)
     openoffice.start()
Exemple #13
0
 def stopProcesses(signum, frame):
   monitor.stop()
   openoffice.stop()
Exemple #14
0
def stopFakeEnvironment(stop_openoffice=True):
    """Stop Openoffice """
    if stop_openoffice:
        openoffice.stop()
    return True
Exemple #15
0
def stopFakeEnvironment(stop_openoffice=True):
    """Stop Openoffice """
    if stop_openoffice:
        openoffice.stop()
    return True