Merge pull request #417 from gurneyalex/7.0-fix_1311004_account_move_line_index-afe
[odoo/odoo.git] / addons / document_ftp / test / document_ftp_test.yml
1 -   |
2     In order to test the document_ftp module in OpenERP, I will try different operations on the FTP interface and check their impacts on OpenERP's documents and vice-versa.
3 -
4     In order to test the behaviour of resource Directory, I will make one resource Directory "Labels" in OpenERP having type "Other Resources" and Directory mapped to object "Partner"
5 -
6     !record {model: 'document.directory', id: dir_label}:
7         name : "Labels"
8         storage_id : document.storage_default
9         type : ressource
10         content_ids:
11             - name: "Label"
12               report_id :  base.res_partner_address_report
13 -
14     Assign "res.partner" object to ressource_type_id. 
15 -
16     !python {model: document.directory}: |
17         ids = self.pool.get('ir.model').search(cr, uid, [('model','=','res.partner')])
18         id = self.write(cr, uid, [ref("dir_label")], {'ressource_type_id' : ids[0]}, context)
19 -
20     In order to check static directory in OpenERP which is the real directory just like system's local folders, 
21     First I create a directory in OpenERP named "Directory 1" with storage as "Default File storage" and type as "Static Directory"
22 -
23     !record {model: 'document.directory', id: directory_file}:
24         name : "File"
25         storage_id : document.storage_default
26         type : directory
27 -
28     I am create one Document name "Document" and select "File" as its Directory,
29 -
30     When I am creating the record, "Resource Title" is filled automatic with "Document".
31 -
32     !record {model: 'ir.attachment', id: document_1}:
33         name : "Document"
34         parent_id : directory_file
35 -
36     In order to connect FTP server and set "File" path,
37     I create one directory "New" in "File" directory from FTP and check its effect in OpenERP.
38 -
39     Also Rename the directory name "New" to "New Directory".
40 -
41     Remove directory "New Directory" and remove file "Document".
42 -
43     !python {model: ir.attachment}: |
44         from ftplib import FTP
45         from tools.misc import detect_ip_addr
46         from tools import config
47         ftp = FTP()
48         if detect_ip_addr:
49             host = config.get('ftp_server_host', detect_ip_addr())
50         else:
51             host = config.get('ftp_server_host', '127.0.0.1')
52         port = config.get('ftp_server_port','8021')
53         ftp.connect(host,port)
54         user = self.pool.get('res.users').read(cr, uid, uid, context)        
55         ftp.login(user.get('login',''),user.get('password',''))
56         ftp.cwd("/" + cr.dbname+"/Documents/File/")
57         ftp.mkd("New")
58         ftp.rename('New','New Directory')
59         ftp.cwd("/" + cr.dbname+"/Documents/File/")
60         ftp.rmd('New Directory')
61         ftp.delete('Document')
62         ftp.quit()
63 -
64     In order to check directory created from FTP is working perfectly
65 -
66     Now I will test the same for Resource directory which is mapped with OpenERP object. 
67     When you open this directory from FTP clients, it displays each record of mapped resource object as directory.
68 -
69     Now I test FTP client and Open the "Labels" Directory to check Resource Directory in FTP.
70     I can see that all Labels of OpenERP are shown as children of "Labels" in FTP client as Directories.
71 -
72     !python {model: ir.attachment}: |
73         from ftplib import FTP
74         from tools.misc import detect_ip_addr
75         from tools import config
76         ftp = FTP()
77         if detect_ip_addr:
78             host = config.get('ftp_server_host', detect_ip_addr())
79         else:
80             host = config.get('ftp_server_host', '127.0.0.1')
81         port = config.get('ftp_server_port','8021')
82         ftp.connect(host,port)
83         user = self.pool.get('res.users').read(cr, uid, uid, context)        
84         ftp.login(user.get('login',''),user.get('password',''))
85         ftp.cwd("/" + cr.dbname+"/Documents/Labels/")
86 -
87     I make sure that I Open Labels Directory successfully.