Files
odoo_source/addons/document_ftp/test/document_ftp_test3.yml
T
P. Christeas 0e8b07f490 Document ftp: have timeout at tests, skip if server is not available.
At trunk-xrg, the FTP daemon is only started *after* the db is loaded,
which means that it will not be available for tests on a server upgrade.
(still, tests can be performed through the base_module_record's importer)

Anyway, it is not wise to block the server startup if FTP doesn't
respond.

bzr revid: p_christ@hol.gr-20100713103016-33gu4o7yvkn7hmnd
2010-07-13 13:30:16 +03:00

83 lines
3.1 KiB
YAML

-
In order to check international character functionality
-
!python {model: ir.attachment}: |
from document_ftp import test_easyftp as te
ftp = te.get_plain_ftp(timeout=1.0)
-
I create in the server a folder called 'Äïêéìáóôéêüò ÖÜêåëëïò'
-
!record {model: document.directory, id: dir_itests }:
name: 'Äïêéìáóôéêüò ÖÜêåëëïò'
parent_id: document.dir_root
-
And then I create another folder, under it, through FTP
-
!python {model: ir.attachment}: |
cr.commit()
from document_ftp import test_easyftp as te
ftp = te.get_ftp_folder(cr, uid, self, 'Documents/Äïêéìáóôéêüò ÖÜêåëëïò')
ftp.mkd("ÖÜêåëëïò áðü êÜôù")
-
I check that this folder exists at the server
-
!assert {model: document.directory, id: , search: "[('name','=','ÖÜêåëëïò áðü êÜôù')]" }:
- parent_id != False
-
I login with FTP and check that 'Äïêéìáóôéêüò ÖÜêåëëïò' is there
-
!python {model: ir.attachment}: |
from document_ftp import test_easyftp as te
ftp = te.get_ftp_folder(cr, uid, self, 'Documents/Äïêéìáóôéêüò ÖÜêåëëïò/ÖÜêåëëïò áðü êÜôù')
-
I create a file named 'ÄïêéìÞ' into that folder
-
!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/Äïêéìáóôéêüò ÖÜêåëëïò/ÖÜêåëëïò áðü êÜôù')
fdata = StringIO('êåßìåíï ìå utf-8')
ftp.storbinary('STOR ÄïêéìÞ.txt', fdata)
-
I remove the 'ÄïêéìÞ.txt' file
-
!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/Äïêéìáóôéêüò ÖÜêåëëïò/ÖÜêåëëïò áðü êÜôù')
ftp.delete('ÄïêéìÞ.txt')
-
I rename 'ÖÜêåëëïò áðü êÜôù' into 'Üëëïò'
-
!python {model: ir.attachment}: |
from document_ftp import test_easyftp as te
ftp = te.get_ftp_folder(cr, uid, self, 'Documents/Äïêéìáóôéêüò ÖÜêåëëïò')
ftp.rename("ÖÜêåëëïò áðü êÜôù", "Üëëïò")
-
I place a file 'file Ö3' in 'Üëëïò'
-
!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/Äïêéìáóôéêüò ÖÜêåëëïò/Üëëïò')
fdata = StringIO('êé Üëëï êåßìåíï')
ftp.storbinary('STOR file Ö3.txt', fdata)
-
I rename the file into file+range(1..200) (large filename)
-
!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/Äïêéìáóôéêüò ÖÜêåëëïò/Üëëïò')
vuvuzela = 'b'+''.join('z' * 200)+'!'
ftp.rename("file Ö3.txt", vuvuzela)
-
I delete the file with the large name
-
!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/Äïêéìáóôéêüò ÖÜêåëëïò/Üëëïò')
vuvuzela = 'b'+''.join('z' * 200)+'!'
ftp.delete(vuvuzela)