summaryrefslogtreecommitdiff
path: root/addons/document_ftp/test
diff options
context:
space:
mode:
authorAntony Lesuisse <al@openerp.com>2014-03-26 14:04:17 +0100
committerAntony Lesuisse <al@openerp.com>2014-03-26 14:04:17 +0100
commite58f289aebff7dabd37b72f8b4d334a89e4e9fd5 (patch)
treebf9a6c6533642d37f2e7ccab39f56054e2a18261 /addons/document_ftp/test
parent502d6770152e13c7560ea3adb25dddd4265dc016 (diff)
[REM] move document_ftp to openerp-extra
bzr revid: al@openerp.com-20140326130417-8226lcfoojop1j5e
Diffstat (limited to 'addons/document_ftp/test')
-rw-r--r--addons/document_ftp/test/document_ftp_test.yml87
-rw-r--r--addons/document_ftp/test/document_ftp_test2.yml289
-rw-r--r--addons/document_ftp/test/document_ftp_test3.yml92
-rw-r--r--addons/document_ftp/test/document_ftp_test4.yml187
-rw-r--r--addons/document_ftp/test/document_ftp_test5.yml30
5 files changed, 0 insertions, 685 deletions
diff --git a/addons/document_ftp/test/document_ftp_test.yml b/addons/document_ftp/test/document_ftp_test.yml
deleted file mode 100644
index fafd5026ebf..00000000000
--- a/addons/document_ftp/test/document_ftp_test.yml
+++ /dev/null
@@ -1,87 +0,0 @@
-- |
- 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.
--
- 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"
--
- !record {model: 'document.directory', id: dir_label}:
- name : "Labels"
- storage_id : document.storage_default
- type : ressource
- content_ids:
- - name: "Label"
- report_id : base.res_partner_address_report
--
- Assign "res.partner" object to ressource_type_id.
--
- !python {model: document.directory}: |
- ids = self.pool.get('ir.model').search(cr, uid, [('model','=','res.partner')])
- id = self.write(cr, uid, [ref("dir_label")], {'ressource_type_id' : ids[0]}, context)
--
- In order to check static directory in OpenERP which is the real directory just like system's local folders,
- First I create a directory in OpenERP named "Directory 1" with storage as "Default File storage" and type as "Static Directory"
--
- !record {model: 'document.directory', id: directory_file}:
- name : "File"
- storage_id : document.storage_default
- type : directory
--
- I am create one Document name "Document" and select "File" as its Directory,
--
- When I am creating the record, "Resource Title" is filled automatic with "Document".
--
- !record {model: 'ir.attachment', id: document_1}:
- name : "Document"
- parent_id : directory_file
--
- In order to connect FTP server and set "File" path,
- I create one directory "New" in "File" directory from FTP and check its effect in OpenERP.
--
- Also Rename the directory name "New" to "New Directory".
--
- Remove directory "New Directory" and remove file "Document".
--
- !python {model: ir.attachment}: |
- from ftplib import FTP
- from openerp.tools.misc import detect_ip_addr
- from openerp.tools import config
- ftp = FTP()
- if detect_ip_addr:
- host = config.get('ftp_server_host', detect_ip_addr())
- else:
- host = config.get('ftp_server_host', '127.0.0.1')
- port = config.get('ftp_server_port','8021')
- ftp.connect(host,port)
- user = self.pool.get('res.users').read(cr, uid, uid, context)
- ftp.login(user.get('login',''),user.get('password',''))
- ftp.cwd("/" + cr.dbname+"/Documents/File/")
- ftp.mkd("New")
- ftp.rename('New','New Directory')
- ftp.cwd("/" + cr.dbname+"/Documents/File/")
- ftp.rmd('New Directory')
- ftp.delete('Document')
- ftp.quit()
--
- In order to check directory created from FTP is working perfectly
--
- Now I will test the same for Resource directory which is mapped with OpenERP object.
- When you open this directory from FTP clients, it displays each record of mapped resource object as directory.
--
- Now I test FTP client and Open the "Labels" Directory to check Resource Directory in FTP.
- I can see that all Labels of OpenERP are shown as children of "Labels" in FTP client as Directories.
--
- !python {model: ir.attachment}: |
- from ftplib import FTP
- from openerp.tools.misc import detect_ip_addr
- from openerp.tools import config
- ftp = FTP()
- if detect_ip_addr:
- host = config.get('ftp_server_host', detect_ip_addr())
- else:
- host = config.get('ftp_server_host', '127.0.0.1')
- port = config.get('ftp_server_port','8021')
- ftp.connect(host,port)
- user = self.pool.get('res.users').read(cr, uid, uid, context)
- ftp.login(user.get('login',''),user.get('password',''))
- ftp.cwd("/" + cr.dbname+"/Documents/Labels/")
--
- I make sure that I Open Labels Directory successfully.
diff --git a/addons/document_ftp/test/document_ftp_test2.yml b/addons/document_ftp/test/document_ftp_test2.yml
deleted file mode 100644
index ce8e25906d2..00000000000
--- a/addons/document_ftp/test/document_ftp_test2.yml
+++ /dev/null
@@ -1,289 +0,0 @@
--
- In order to test the document_ftp functionality
--
- I open the 8021 port and see for ftp presence there
--
- !python {model: ir.attachment}: |
- from document_ftp import test_easyftp as te
- ftp = te.get_plain_ftp(timeout=2.0)
- assert ftp.sock and (ftp.lastresp == '220'), ftp.lastresp
- ftp.close()
--
- I read the list of databases at port 8021 and confirm our db is
- there
--
- !python {model: ir.attachment}: |
- from document_ftp import test_easyftp as te
- ftp = te.get_ftp_login(cr, uid, self)
- assert cr.dbname in ftp.nlst("/")
- ftp.close()
--
- I try to locate the default "Documents" folder in the db.
--
- !python {model: ir.attachment}: |
- from document_ftp import test_easyftp as te
- ftp = te.get_ftp_login(cr, uid, self)
- ftp.cwd('Documents')
- ftp.close()
--
- I create a "test.txt" file at the server (directly). The file
- should have the "abcd" content
--
- !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('abcd')
- ftp.storbinary('STOR test.txt', fdata)
- ftp.close()
--
- I look for the "test.txt" file at the server
--
- !python {model: ir.attachment}: |
- from document_ftp import test_easyftp as te
- ftp = te.get_ftp_folder(cr, uid, self, 'Documents')
- assert ftp.nlst("test.txt") == ['test.txt']
- ftp.close()
--
- I check that the content of "test.txt" is "abcd"
--
- !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')
- gotdata = te.get_ftp_fulldata(ftp, "test.txt")
- ftp.close()
- assert gotdata == 'abcd', 'Data: %r' % gotdata
--
- I append the string 'defgh' to "test.txt"
--
- !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('defgh')
- ftp.storbinary('APPE test.txt', fdata)
- ftp.close()
--
- I check that the content of "text.txt" is 'abcddefgh'
--
- !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')
- gotdata = te.get_ftp_fulldata(ftp, "test.txt")
- ftp.close()
- assert gotdata == 'abcddefgh', 'Data: %r' % gotdata
--
- I try to cd into an non-existing folder 'Not-This'
--
- !python {model: ir.attachment}: |
- from document_ftp import test_easyftp as te
- import ftplib
- ftp = te.get_ftp_login(cr, uid, self)
- try:
- ftp.cwd('/Not-This')
- assert False, "We should't be able to change here"
- except ftplib.error_perm:
- pass
- except OSError, err:
- ftp.close()
- assert err.errno == 2, err.errno
- ftp.close()
--
- I create a "test2.txt" file 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')
- fdata = StringIO('abcd')
- ftp.storbinary('STOR test2.txt', fdata)
- ftp.close()
--
- I look for the "test2.txt" file at the server
--
- !python {model: ir.attachment }: |
- cr.rollback() # restart transaction to see changes (FTP-FS uses its own cursor)
- ids = self.search(cr, uid, [('name', '=', 'test2.txt')])
- assert ids, "No test2.txt file found."
--
- I delete the "test2.txt" file using 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')
- ftp.delete('test2.txt')
- ftp.close()
--
- I check at the server that test2.txt is deleted
--
- !python {model: ir.attachment }: |
- cr.rollback() # restart transaction to see changes (FTP-FS uses its own cursor)
- ids = self.search(cr, uid, [('name', '=', 'test2.txt')])
- assert not ids, "test2.txt file can still be found."
--
- I create a test2.txt file again.
--
- !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('abcd')
- ftp.storbinary('STOR test2.txt', fdata)
- ftp.close()
- cr.rollback() # restart transaction to see changes (FTP-FS uses its own cursor)
--
- I delete the test2.txt from the server (RPC).
--
- !delete { model: ir.attachment, id:, search: "[('name','=','test2.txt')]" }
--
- I also commit, because ftp would run in a different transaction.
--
- !python {model: ir.attachment}: |
- cr.commit()
--
- I check through FTP that test2.txt does not appear.
--
- !python {model: ir.attachment}: |
- from document_ftp import test_easyftp as te
- import ftplib
- ftp = te.get_ftp_folder(cr, uid, self, 'Documents')
- try:
- nlst_result = ftp.nlst("test2.txt")
- except ftplib.error_perm: # 550 error: 'path not exists'
- nlst_result = []
- assert "test2.txt" not in nlst_result, "Files: %r" % nlst_result
- ftp.close()
--
- I create a "test-name.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')
- fdata = StringIO('abcd')
- ftp.storbinary('STOR test-name.txt', fdata)
- ftp.close()
--
- I rename the "test-name.txt" file through ftp.
--
- !python {model: ir.attachment}: |
- from document_ftp import test_easyftp as te
- ftp = te.get_ftp_folder(cr, uid, self, 'Documents')
- ftp.rename("test-name.txt", "test-renamed.txt")
- ftp.close()
--
- I check that test-name.txt has been renamed.
--
- !python {model: ir.attachment}: |
- from document_ftp import test_easyftp as te
- from ftplib import error_perm
- ftp = te.get_ftp_folder(cr, uid, self, 'Documents')
- try:
- res = ftp.nlst("test-name.txt")
- assert res == [], "File has not been renamed!"
- except error_perm, e:
- pass
- assert ftp.nlst("test-renamed.txt") == ['test-renamed.txt']
- ftp.close()
--
- I create a new folder 'Test-Folder2' through FTP
--
- !python {model: ir.attachment}: |
- from document_ftp import test_easyftp as te
- ftp = te.get_ftp_folder(cr, uid, self, 'Documents')
- ftp.mkd("Test-Folder2")
- ftp.close()
--
- I create a file 'test3.txt' at the 'Test-Folder2'
--
- !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/Test-Folder2')
- fdata = StringIO('abcd')
- ftp.storbinary('STOR test3.txt', fdata)
- ftp.close()
--
- I try to retrieve test3.txt
--
- !python {model: ir.attachment}: |
- from document_ftp import test_easyftp as te
- ftp = te.get_ftp_folder(cr, uid, self, 'Documents/Test-Folder2')
- assert ftp.nlst("test3.txt") == ['test3.txt'], "File test3.txt is not there!"
- ftp.close()
--
- I create a new folder, 'Test-Folder3', through FTP
- I try to move test3.txt to 'Test-Folder3'
--
- !python {model: ir.attachment}: |
- from document_ftp import test_easyftp as te
- ftp = te.get_ftp_folder(cr, uid, self, 'Documents')
- ftp.mkd("Test-Folder3")
- ftp.close()
- # TODO move
--
- I remove the 'Test-Folder3'
--
- !python {model: ir.attachment}: |
- from document_ftp import test_easyftp as te
- ftp = te.get_ftp_folder(cr, uid, self, 'Documents')
- ftp.rmd("Test-Folder3")
- ftp.close()
--
- I check that test3.txt is removed.
--
- I create 5 files 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/Test-Folder2')
- fdata = StringIO('abcd')
- for i in range(0, 5):
- fdata.seek(0)
- ftp.storbinary('STOR test-name%s.txt' %i, fdata)
- ftp.close()
--
- I list the 5 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')
- assert len(ftp.nlst()) >= 5, "We haven't managed to store 5 files!"
--
- I read the 5 files, check speed
--
- I move the 5 files to 'Test-Folder2'
--
- I delete the 5 files
--
- !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/Test-Folder2')
- ftp.delete('test3.txt')
- for i in range(0, 5):
- ftp.delete('test-name%s.txt' %i)
- ftp.close()
-
--
- I delete the "test.txt" and "test-renamed.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('test.txt')
- ftp.delete('test-renamed.txt')
- ftp.close()
--
- I remove the 'Test-Folder2'
--
- !python {model: ir.attachment}: |
- from document_ftp import test_easyftp as te
- ftp = te.get_ftp_folder(cr, uid, self, 'Documents')
- ftp.rmd("Test-Folder2")
- ftp.close()
diff --git a/addons/document_ftp/test/document_ftp_test3.yml b/addons/document_ftp/test/document_ftp_test3.yml
deleted file mode 100644
index a51f259f44e..00000000000
--- a/addons/document_ftp/test/document_ftp_test3.yml
+++ /dev/null
@@ -1,92 +0,0 @@
--
- 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)
-
--
- I delete the testing folders
--
- !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.rmd('Δοκιμαστικός Φάκελλος/άλλος')
- ftp.rmd('Δοκιμαστικός Φάκελλος')
diff --git a/addons/document_ftp/test/document_ftp_test4.yml b/addons/document_ftp/test/document_ftp_test4.yml
deleted file mode 100644
index 9b311f64605..00000000000
--- a/addons/document_ftp/test/document_ftp_test4.yml
+++ /dev/null
@@ -1,187 +0,0 @@
--
- 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'
- I attach Partner1 to pat1, Partner1+Partner2 to 'all'
--
- !record {model: res.partner.category, id: tpat_categ_none }:
- name: 'No partners'
--
- !record {model: res.partner.category, id: tpat_categ_pat1 }:
- name: 'Pat 1'
--
- !record {model: res.partner.category, id: tpat_categ_all }:
- name: 'All Partner1+2'
--
- !record {model: res.partner, id: tpartner1 }:
- name: Partner 1
- category_id:
- - tpat_categ_pat1
- - tpat_categ_all
--
- !record {model: res.partner, id: tpartner_2 }:
- name: 'Partner 2'
- category_id:
- - tpat_categ_all
--
- I create a resource folder of partners, by the (none, pat1, all)
- categories.
--
- !record {model: document.directory, id: dir_tests2 }:
- name: Partners Testing
- parent_id: document.dir_root
- type: ressource
- ressource_type_id: base.model_res_partner_category
- domain: [] # TODO
--
- I commit (because FTP operations are on different transaction)
--
- !python {model: document.directory, id: }: |
- cr.commit()
--
- I browse through ftp in the resource folder, checking that three
- categories are there.
--
- !python {model: ir.attachment}: |
- from document_ftp import test_easyftp as te
- ftp = te.get_ftp_folder(cr, uid, self, 'Documents/Partners Testing')
- dirs = ftp.nlst()
- 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
--
- I commit (because FTP operations are on different transaction)
--
- !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 commit (because FTP operations are on different transaction)
--
- !python {model: document.directory, id: }: |
- cr.commit()
--
- 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)
- cr.rollback() # restart transaction to see changes (FTP-FS uses its own cursor)
--
- 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 == 'Documents'
- - res_model == 'res.partner'
- - res_id != False
--
- I try to create a file directly under the Partners Testing folder
--
- !python {model: ir.attachment}: |
- from document_ftp import test_easyftp as te
- import ftplib
- from cStringIO import StringIO
- ftp = te.get_ftp_folder(cr, uid, self, 'Documents/Partners Testing')
- fdata = StringIO('abcd')
- try:
- ftp.storbinary('STOR stray.txt', fdata)
- assert False, "We should't be able to create files here"
- except ftplib.error_perm:
- # That's what should happen
- pass
--
- I try to create a folder directly under the Partners Testing folder
--
- !python {model: ir.attachment}: |
- from document_ftp import test_easyftp as te
- import ftplib
- from cStringIO import StringIO
- ftp = te.get_ftp_folder(cr, uid, self, 'Documents/Partners Testing')
- try:
- ftp.mkd('Weird folder')
- assert False, "We should't be able to create folders here"
- except ftplib.error_perm:
- # That's what should happen
- pass
--
- I check that all/Partner1 also has the file
-- |
- Bonus Piste:
- I create a 'Partner3' under 'all'
-
--
- I delete "pat1-dynamic.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/Partners Testing/Pat 1/Partners of Test/Partner 1')
- ftp.delete('pat1-dynamic.txt')
- ftp.close()
- cr.rollback() # restart transaction to see changes (FTP-FS uses its own cursor)
-
--
- I delete the Partners Testing folder, "File of pat1" file, Partner and Partner category.
--
- !python {model: document.directory}: |
- attach_pool = self.pool.get('ir.attachment')
- partner_categ_pool = self.pool.get('res.partner.category')
- partner_pool = self.pool.get('res.partner')
-
- self.unlink(cr, uid, [ref('dir_tests2')])
- self.unlink(cr, uid, [ref('dir_respart1')])
- attach_pool.unlink(cr, uid, [ref('file_test1')])
- partner_categ_pool.unlink(cr, uid, [ref('tpat_categ_none')])
- partner_categ_pool.unlink(cr, uid, [ref('tpat_categ_pat1')])
- partner_categ_pool.unlink(cr, uid, [ref('tpat_categ_all')])
- partner_pool.unlink(cr, uid, [ref('tpartner1')])
- partner_pool.unlink(cr, uid, [ref('tpartner_2')])
- cr.commit() #required because all the operations via FTP were committed
-
diff --git a/addons/document_ftp/test/document_ftp_test5.yml b/addons/document_ftp/test/document_ftp_test5.yml
deleted file mode 100644
index a66f409905b..00000000000
--- a/addons/document_ftp/test/document_ftp_test5.yml
+++ /dev/null
@@ -1,30 +0,0 @@
--
- In order to check the permissions setup and functionality of the
- document module:
--
- I create a testing user for the documents
--
- I assign some ... group to the testing user
--
- I create a "group testing" user, which also belongs to the same ... group
--
- I create a "blocked" user.
--
- I create (as root) a testing folder in the document hierarchy, and
- assign ownership to the testing user, groups to the ... group.
--
- I create a "private" folder inside the testing folder.
--
- I try to read the testing folder as the testing user
--
- I try to read the folder as the group user, it should fail.
--
- I try to read the folder as the blocked user.
--
- I create a "group" folder, with the ... group.
--
- I try to read the "group" folder as the testing user
--
- I try to read the "group" folder as the group user
--
- I try to read the "group" folder as the blocked user