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
This commit is contained in:
P. Christeas 2010-07-13 13:30:16 +03:00
parent d9553df1a2
commit 0e8b07f490
4 changed files with 11 additions and 3 deletions

View File

@ -5,7 +5,7 @@
-
!python {model: ir.attachment}: |
from document_ftp import test_easyftp as te
ftp = te.get_plain_ftp()
ftp = te.get_plain_ftp(timeout=2.0)
assert ftp.sock and (ftp.lastresp == '220'), ftp.lastresp
-
I read the list of databases at port 8021 and confirm our db is

View File

@ -1,5 +1,9 @@
-
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 'Äïêéìáóôéêüò ÖÜêåëëïò'
-

View File

@ -1,5 +1,9 @@
-
In order to check dynamic folder functionality of document + FTP
-
!python {model: ir.attachment}: |
from document_ftp import test_easyftp as te
ftp = te.get_plain_ftp(timeout=1.0)
- |
I create two partners 'Partner1' and 'Partner2'.
I create three partner categories: 'none', 'pat1' and 'all'

View File

@ -28,11 +28,11 @@ from ftplib import FTP
from tools.misc import detect_ip_addr
from tools import config
def get_plain_ftp():
def get_plain_ftp(timeout=10.0):
ftp = FTP()
host = config.get('ftp_server_host', '127.0.0.1')
port = config.get('ftp_server_port','8021')
ftp.connect(host,port)
ftp.connect(host,port, timeout=timeout)
return ftp
def get_ftp_login(cr, uid, ormobj):