summaryrefslogtreecommitdiff
path: root/addons/document_ftp/test
diff options
context:
space:
mode:
authorHarry (OpenERP) <hmo@tinyerp.com>2011-12-14 17:59:24 +0530
committerHarry (OpenERP) <hmo@tinyerp.com>2011-12-14 17:59:24 +0530
commit092f97b32b35af6a40b9d2ae70c3159da2fb235f (patch)
tree2974d3719af9338cd0b1814da900d7e9ca8d4779 /addons/document_ftp/test
parent593f5f571bbc49673975afc405e9345ef3457b92 (diff)
parente36dc8c5e3ca3da1474747bae5ec87fea19b23b8 (diff)
[MERGE] merged with trunk-development-branch
bzr revid: hmo@tinyerp.com-20111214122924-izzibrz1yz67rt7g
Diffstat (limited to 'addons/document_ftp/test')
-rw-r--r--addons/document_ftp/test/document_ftp_test2.yml6
-rw-r--r--addons/document_ftp/test/document_ftp_test4.yml16
2 files changed, 14 insertions, 8 deletions
diff --git a/addons/document_ftp/test/document_ftp_test2.yml b/addons/document_ftp/test/document_ftp_test2.yml
index 33ce1416ec8..eb86a99407d 100644
--- a/addons/document_ftp/test/document_ftp_test2.yml
+++ b/addons/document_ftp/test/document_ftp_test2.yml
@@ -100,11 +100,11 @@
fdata = StringIO('abcd')
ftp.storbinary('STOR test2.txt', fdata)
ftp.close()
- cr.commit()
-
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."
-
@@ -116,11 +116,11 @@
ftp = te.get_ftp_folder(cr, uid, self, 'Documents')
ftp.delete('test2.txt')
ftp.close()
- cr.commit()
-
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."
-
@@ -133,7 +133,7 @@
fdata = StringIO('abcd')
ftp.storbinary('STOR test2.txt', fdata)
ftp.close()
- cr.commit()
+ cr.rollback() # restart transaction to see changes (FTP-FS uses its own cursor)
-
I delete the test2.txt from the server (RPC).
-
diff --git a/addons/document_ftp/test/document_ftp_test4.yml b/addons/document_ftp/test/document_ftp_test4.yml
index 0a3ff33333e..9b311f64605 100644
--- a/addons/document_ftp/test/document_ftp_test4.yml
+++ b/addons/document_ftp/test/document_ftp_test4.yml
@@ -4,7 +4,6 @@
!python {model: ir.attachment}: |
from document_ftp import test_easyftp as te
ftp = te.get_plain_ftp(timeout=1.0)
- cr.commit()
- |
I create two partners 'Partner1' and 'Partner2'.
I create three partner categories: 'none', 'pat1' and 'all'
@@ -54,7 +53,6 @@
dirs = ftp.nlst()
for dir in [ 'All Partner1+2', 'No partners', 'Pat 1' ]:
assert dir in dirs, "Dir %s not in folder" % dir
- cr.commit()
-
I create a 'partners' folder by the first resource one.
-
@@ -66,6 +64,8 @@
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()
-
@@ -81,7 +81,6 @@
for dir in correct:
res = ftp.nlst(dir+'/Partners of Test')
assert res == correct[dir], "Dir %s falsely contains %s" %(dir, res)
- cr.commit()
-
I create an ir.attachment, attached (not related) to Partner1
-
@@ -90,6 +89,11 @@
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
-
@@ -109,6 +113,7 @@
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
-
@@ -159,7 +164,8 @@
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()
+ 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.
@@ -177,5 +183,5 @@
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()
+ cr.commit() #required because all the operations via FTP were committed