65 lines
2.4 KiB
YAML
65 lines
2.4 KiB
YAML
-
|
|
In order to test the document_webdav functionality
|
|
-
|
|
I open the HTTP port and perform an OPTIONS request to the server
|
|
-
|
|
!python {model: ir.attachment}: |
|
|
from document_webdav import test_davclient as te
|
|
reload(te) # reload..
|
|
dc = te.DAVClient(timeout=2.0)
|
|
# have a small timeout, enough for any heavily-loaded test server to
|
|
# respond, but small so that this test won't block further loading.
|
|
# Don't catch the exception, so that the whole YAML test will abort
|
|
# if the WebDAV service is not available (eg. during an upgrade from
|
|
# command line).
|
|
dc.gd_options()
|
|
dc.get_creds(self, cr, uid)
|
|
dc.gd_options(path=cr.dbname, expect={'DAV': ['1',]})
|
|
-
|
|
I will test the propnames at the document root
|
|
-
|
|
!python {model: ir.attachment}: |
|
|
from document_webdav import test_davclient as te
|
|
dc = te.DAVClient()
|
|
dc.get_creds(self, cr, uid)
|
|
dc.gd_propname(path=cr.dbname+'/Documents/')
|
|
-
|
|
I will test the ETags of the document root
|
|
-
|
|
!python {model: ir.attachment}: |
|
|
from document_webdav import test_davclient as te
|
|
dc = te.DAVClient()
|
|
dc.get_creds(self, cr, uid)
|
|
dc.gd_getetag(path=cr.dbname+'/Documents/')
|
|
|
|
-
|
|
I will now ls -l the document root.
|
|
-
|
|
!python {model: ir.attachment}: |
|
|
from document_webdav import test_davclient as te
|
|
dc = te.DAVClient()
|
|
dc.get_creds(self, cr, uid)
|
|
res = dc.gd_lsl(path=cr.dbname+'/Documents/')
|
|
for lin in res:
|
|
print "%(type)s\t%(uid)s\t%(gid)s\t%(size)s\t%(mtime)s\t%(name)s" % lin
|
|
-
|
|
I will put a file to the server
|
|
-
|
|
!python {model: ir.attachment}: |
|
|
from document_webdav import test_davclient as te
|
|
import addons
|
|
dc = te.DAVClient()
|
|
dc.get_creds(self, cr, uid)
|
|
tdp = addons.get_module_resource('document_webdav', 'test_davclient.py')
|
|
res = dc.gd_put(path=cr.dbname+'/Documents/test_davclient.py', srcpath=tdp)
|
|
-
|
|
I will try to get the file from the root
|
|
-
|
|
!python {model: ir.attachment}: |
|
|
from document_webdav import test_davclient as te
|
|
import addons
|
|
dc = te.DAVClient()
|
|
dc.get_creds(self, cr, uid)
|
|
tdp = addons.get_module_resource('document_webdav', 'test_davclient.py')
|
|
res = dc.gd_get(path=cr.dbname+'/Documents/test_davclient.py', crange=(4,508), compare=tdp)
|