nsi.granulate.tests.testGranulateDOC

Package nsi :: Package granulate :: Package tests :: Module testGranulateDOC |
[hide private]
[frames] | no frames]

# Source Code for Module nsi.granulate.tests.testGranulateDOC

     1  #!/usr/bin/python
     2  ##############################################################################
     3  #
     4  # Copyright (c) 2007 ISrg (NSI, CEFETCAMPOS, BRAZIL) and Contributors.
     5  #                                                         All Rights Reserved.
     6  #                              Ronaldo Amaral Santos <ronaldinho.as@gmail.com>
     7  #
     8  # WARNING: This program as such is intended to be used by professional
     9  # programmers who take the whole responsability of assessing all potential
    10  # consequences resulting from its eventual inadequacies and bugs
    11  # End users who are looking for a ready-to-use solution with commercial
    12  # garantees and support are strongly adviced to contract a Free Software
    13  # Service Company
    14  #
    15  # This program is Free Software; you can redistribute it and/or
    16  # modify it under the terms of the GNU General Public License
    17  # as published by the Free Software Foundation; either version 2
    18  # of the License, or (at your option) any later version.
    19  #
    20  # This program is distributed in the hope that it will be useful,
    21  # but WITHOUT ANY WARRANTY; without even the implied warranty of
    22  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    23  # GNU General Public License for more details.
    24  #
    25  # You should have received a copy of the GNU General Public License
    26  # along with this program; if not, write to the Free Software
    27  # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
    28  #
    29  ##############################################################################
    30
    31  __author__ = """Ronaldo Amaral Santos <ronaldinho.as@gmail.com>"""
    32  __docformat__ = 'plaintext'
    33
    34  """
    35      Test methods Granulate
    36  """
    37
    38  import sys, unittest
    39  import re, time,os
    40  from nsi.granulate import Granulate
    41
    42
    43  filePath = os.path.join(os.path.dirname(__file__), 'data', 'test.doc')
    44
    45  try:
    46      filedata = open(filePath, 'rb').read()
    47  except IOError:
    48      print "File not found"
    49      sys.exit(1)
    50
    51
    52 -class TestGranulate(unittest.TestCase):
    53
    54
    55 -    def testGranulateDocument(self):
    56          """
    57              This test passes arguments the old way.
    58          """
    59          t1 = time.time()
    60          resultDict = Granulate(host="200.167.129.78",port=8008).granulateDocument(filename='teste.doc', data=filedata)
    61          print resultDict['image_list']
    62          print resultDict['table_list']
    63          #self.assertEquals(len(resultDict['image_list']), 26)
    64          #self.assertEquals(len(resultDict['table_list']), 1)
    65          print (time.time() -t1)/(24*3600)
    66
    67
    68  if __name__=='__main__':
    69      tests=(TestGranulate,)
    70      for t in tests:
    71          suite = unittest.makeSuite(t)
    72          unittest.TextTestRunner(verbosity=2).run(suite)
    73