Document ftp: Only test with 200 files, todo comment.

bzr revid: p_christ@hol.gr-20100709082356-p6xij5d22spqxrrx
This commit is contained in:
P. Christeas 2010-07-09 11:23:56 +03:00
parent 60727b0cb0
commit 74b2dcfd80
2 changed files with 55 additions and 11 deletions

View File

@ -193,7 +193,7 @@
-
I check that test3.txt is removed.
-
I create 1000 files through FTP
I create 200 files through FTP
-
!python {model: ir.attachment}: |
from document_ftp import test_easyftp as te
@ -201,21 +201,21 @@
ftp = te.get_ftp_folder(cr, uid, self, 'Documents/Test-Folder2')
fdata = StringIO('abcd')
# TODO speed
for i in range(0, 1000):
for i in range(0, 200):
fdata.seek(0)
ftp.storbinary('STOR test-name%s.txt' %i, fdata)
-
I list the 1000 files, check speed
I list the 200 files, check speed
-
!python {model: ir.attachment}: |
from document_ftp import test_easyftp as te
ftp = te.get_ftp_folder(cr, uid, self, 'Documents/Test-Folder2')
# TODO speed
assert len(ftp.nlst()) > 1000
assert len(ftp.nlst()) > 200
-
I read the 1000 files, check speed
I read the 200 files, check speed
# TODO
-
I move the 1000 files to 'Test-Folder2'
I move the 200 files to 'Test-Folder2'
# TODO
-

View File

@ -33,7 +33,7 @@
parent_id: document.dir_root
type: ressource
ressource_type_id: base.model_res_partner_category
domain: []
domain: [] # TODO
-
I commit (because FTP operations are on different transaction)
-
@ -47,26 +47,70 @@
from document_ftp import test_easyftp as te
ftp = te.get_ftp_folder(cr, uid, self, 'Documents/Partners Testing')
dirs = ftp.nlst()
dirs.sort()
assert dirs == [ 'All Partner1+2', 'No partners', 'Pat 1' ]
for dir in [ 'All Partner1+2', 'No partners', 'Pat 1' ]:
assert dir in dirs, "Dir %s not in folder" % dir
-
I create a 'partners' folder by the first resource one.
-
!record {model: document.directory, id: dir_respart1 }:
name: Partners of Test
parent_id: dir_tests2
type: ressource
ressource_type_id: base.model_res_partner
domain: "[('category_id','in',[active_id])]"
ressource_parent_type_id : base.model_res_partner_category
-
!python {model: document.directory, id: }: |
cr.commit()
-
I check through FTP that the correct partners are listed at each
'partners' folder.
-
!python {model: ir.attachment}: |
from document_ftp import test_easyftp as te
ftp = te.get_ftp_folder(cr, uid, self, 'Documents/Partners Testing')
correct = { 'All Partner1+2': [ 'Partner 1', 'Partner 2' ],
'No partners': [],
'Pat 1': ['Partner 1',] }
for dir in correct:
res = ftp.nlst(dir+'/Partners of Test')
assert res == correct[dir], "Dir %s falsely contains %s" %(dir, res)
-
I create an ir.attachment, attached (not related) to Partner1
-
!record {model: ir.attachment, id: file_test1 }:
name: File of pat1
res_model: res.partner
res_id: !eval ref("tpartner1")
-
I check that pat1/Partner1 folder has the file.
I check that all/Partner1 folder has the file
-
!python {model: ir.attachment}: |
from document_ftp import test_easyftp as te
ftp = te.get_ftp_folder(cr, uid, self, 'Documents/Partners Testing')
dirs = [ 'All Partner1+2', 'Pat 1' ]
for dir in dirs:
res = ftp.nlst(dir+'/Partners of Test/Partner 1')
assert 'File of pat1' in res, "Dir %s contains only %s" %(dir, res)
-
I place a file at the 'pat1'/Partner1 folder, through FTP
-
!python {model: ir.attachment}: |
from document_ftp import test_easyftp as te
from cStringIO import StringIO
ftp = te.get_ftp_folder(cr, uid, self, 'Documents/Partners Testing/Pat 1/Partners of Test/Partner 1')
fdata = StringIO('abcd')
ftp.storbinary('STOR pat1-dynamic.txt', fdata)
-
I check at the server that the file is attached to Partner1
-
!assert {model: ir.attachment, id: , search: "[('name','=','pat1-dynamic.txt')]" }:
- parent_id.name == 'Partners of Test'
- res_model == 'res.partner'
- res_id != False
-
I check that all/Partner1 also has the file
- |
Bonus Piste:
I create a 'Partner3' under 'all'
-