Commit 15afa0e6 authored by Bartek Górny's avatar Bartek Górny

brought tests up2date with implementation; added test for External Document

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@9936 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 593b93ae
......@@ -55,6 +55,9 @@ from zLOG import LOG
import os
from Products.ERP5Type import product_path
# XXX set it to an appropriate value
erp5_port=80
class TestDms(ERP5TypeTestCase):
"""
"""
......@@ -119,7 +122,7 @@ class TestDms(ERP5TypeTestCase):
role._edit(agent='person_module/1',role_name='Assignor')
def printAndCheck(self,doc):
self.assert_(u'Auditor' in doc.__ac_local_roles__.get('hq',[]))
self.assert_(u'Auditor' in doc.__ac_local_roles__.get('HQ',[]))
def test_02_ObjectCreation(self,quiet=0,run=run_all_test):
if not quiet:
......@@ -153,7 +156,7 @@ class TestDms(ERP5TypeTestCase):
f.close()
self.assert_(doctext.isFileUploaded())
self.assert_(not doctext.hasOOfile())
ZopeTestCase._print('\n originalloaded '+str(doctext.getOriginalFilename()))
ZopeTestCase._print('\n originalloaded '+str(doctext.getSourceReference()))
ZopeTestCase._print('\n isFileUploaded '+str(doctext.isFileUploaded()))
ZopeTestCase._print('\n hasOOfile '+str(doctext.hasOOfile()))
doctext.convert()
......@@ -195,6 +198,21 @@ class TestDms(ERP5TypeTestCase):
mtype=doctext.guessMimeType('file.doc')
self.assertEquals(mtype,'application/msword')
def test_06_ExternalDocument(self,quiet=0,run=run_all_test):
if not quiet:
ZopeTestCase._print('\nTest External Document')
LOG('Testing... ',0,'test_06_ExternalDocument')
dm=self.getPortal().document_module
doctext=dm.newContent(portal_type='External Document',id='ext1')
self.assert_('http' in doctext.getProtocolList())
doctext.setUrlProtocol('http')
doctext.setUrlString('localhost:%i' % erp5_port)
doctext.spiderSource()
if not quiet:
ZopeTestCase._print(doctext.getStatusMessage())
LOG('Testing External Document... ',0,doctext.getStatusMessage())
self.assert_(doctext.getTextContent().find('My language')>-1)
if __name__ == '__main__':
......
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