From 313897186c307afec4b5211f7db9df42c5f83844 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Wed, 30 Nov 2011 13:02:44 +0100 Subject: [IMP] document_ftp: improve/sanitize transaction management during tests Now that spurious commits were removed in document module, the test would not run properly anymore. We do need special care with transactions when we test the FTP layer because operations on the virtual FS are done in their own transaction, and immediately committed. In order for test code and FTP operations to be able to see each other, the transactions need to be synchronized. The current test transaction needs to be rolled back or committed after reach FTP operation so it can "see" the latest changes in the database. Similarly, we must force a commit of the test transaction whenever we want the FTP layer to be able to see its effects. bzr revid: odo@openerp.com-20111130120244-3m15sxdx1x5x1q1x --- addons/document_ftp/test/document_ftp_test2.yml | 6 +++--- addons/document_ftp/test/document_ftp_test4.yml | 16 +++++++++++----- 2 files changed, 14 insertions(+), 8 deletions(-) (limited to 'addons/document_ftp') 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. - @@ -65,6 +63,8 @@ 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() @@ -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 - @@ -89,6 +88,11 @@ 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 @@ -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 -- cgit v1.2.3 From 0eab577b40cb1d253915655b84923911101b72f6 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Tue, 6 Dec 2011 12:21:27 +0100 Subject: [IMP] Core modules for apps bzr revid: fp@tinyerp.com-20111206112127-5lir7aovygx4a4oi --- addons/document_ftp/__openerp__.py | 1 + 1 file changed, 1 insertion(+) (limited to 'addons/document_ftp') diff --git a/addons/document_ftp/__openerp__.py b/addons/document_ftp/__openerp__.py index 499a928c077..d70a14a433c 100644 --- a/addons/document_ftp/__openerp__.py +++ b/addons/document_ftp/__openerp__.py @@ -49,6 +49,7 @@ FTP client. ], 'installable': True, 'active': False, + 'core': True, 'certificate': '00934787762705016005', 'images': ['images/1_configure_ftp.jpeg','images/2_document_browse.jpeg','images/3_document_ftp.jpeg'], 'post_load': 'post_load', -- cgit v1.2.3 From 1831cddc7ee8a4c2a2b9c3233440ea7755557fd4 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Thu, 8 Dec 2011 16:14:55 +0100 Subject: [FIX] core -> is_application bzr revid: chs@openerp.com-20111208151455-d7pffuiwxdns76ec --- addons/document_ftp/__openerp__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/document_ftp') diff --git a/addons/document_ftp/__openerp__.py b/addons/document_ftp/__openerp__.py index d70a14a433c..8d80c01c57c 100644 --- a/addons/document_ftp/__openerp__.py +++ b/addons/document_ftp/__openerp__.py @@ -49,7 +49,7 @@ FTP client. ], 'installable': True, 'active': False, - 'core': True, + 'is_application': True, 'certificate': '00934787762705016005', 'images': ['images/1_configure_ftp.jpeg','images/2_document_browse.jpeg','images/3_document_ftp.jpeg'], 'post_load': 'post_load', -- cgit v1.2.3 From 69f685f386d2971a5d9ce85252848e3cb35a9e23 Mon Sep 17 00:00:00 2001 From: Antony Lesuisse Date: Thu, 8 Dec 2011 23:25:43 +0100 Subject: [IMP] rename is_application to application bzr revid: al@openerp.com-20111208222543-avte2h9qit5zfvht --- addons/document_ftp/__openerp__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/document_ftp') diff --git a/addons/document_ftp/__openerp__.py b/addons/document_ftp/__openerp__.py index 8d80c01c57c..a7b5a65e227 100644 --- a/addons/document_ftp/__openerp__.py +++ b/addons/document_ftp/__openerp__.py @@ -49,7 +49,7 @@ FTP client. ], 'installable': True, 'active': False, - 'is_application': True, + 'application': True, 'certificate': '00934787762705016005', 'images': ['images/1_configure_ftp.jpeg','images/2_document_browse.jpeg','images/3_document_ftp.jpeg'], 'post_load': 'post_load', -- cgit v1.2.3 From 5bb0bf0441bc0c98de75a8285ea7ed92ccd7e2d3 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Sun, 11 Dec 2011 22:25:10 +0100 Subject: [IMP] Core applciations update bzr revid: fp@tinyerp.com-20111211212510-d61afdy0nyw74j6c --- addons/document_ftp/__openerp__.py | 1 - 1 file changed, 1 deletion(-) (limited to 'addons/document_ftp') diff --git a/addons/document_ftp/__openerp__.py b/addons/document_ftp/__openerp__.py index a7b5a65e227..499a928c077 100644 --- a/addons/document_ftp/__openerp__.py +++ b/addons/document_ftp/__openerp__.py @@ -49,7 +49,6 @@ FTP client. ], 'installable': True, 'active': False, - 'application': True, 'certificate': '00934787762705016005', 'images': ['images/1_configure_ftp.jpeg','images/2_document_browse.jpeg','images/3_document_ftp.jpeg'], 'post_load': 'post_load', -- cgit v1.2.3 From f27318c8af85955ef23b709f5fe7f87ee0974bb3 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Mon, 12 Dec 2011 19:11:13 +0100 Subject: [IMP] Security Rule: removed duplicates due to inheritancies of groups bzr revid: fp@tinyerp.com-20111212181113-mhnnbps3ip8ls6pp --- addons/document_ftp/security/ir.model.access.csv | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'addons/document_ftp') diff --git a/addons/document_ftp/security/ir.model.access.csv b/addons/document_ftp/security/ir.model.access.csv index 0a6c192eb56..4a08a4aa60d 100644 --- a/addons/document_ftp/security/ir.model.access.csv +++ b/addons/document_ftp/security/ir.model.access.csv @@ -1,2 +1 @@ -"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink" - +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink -- cgit v1.2.3