diff options
| author | Harry (OpenERP) <hmo@tinyerp.com> | 2010-07-20 18:35:13 +0530 |
|---|---|---|
| committer | Harry (OpenERP) <hmo@tinyerp.com> | 2010-07-20 18:35:13 +0530 |
| commit | 77f62a88a314a905e5ffc73cffd72d68ddfe33db (patch) | |
| tree | edc70351000fba9ea5a4ab27a3f680c5844e9e82 /addons/document/test/document_test2.yml | |
| parent | 90234707dc901a81935570274c52a5327940b66e (diff) | |
| parent | 1eea693ecadd3829fa729a727a154c23a1df6ab6 (diff) | |
[MERGE] merged new api of document module
bzr revid: hmo@tinyerp.com-20100720130513-3t2cbyvns3hlj6qn
Diffstat (limited to 'addons/document/test/document_test2.yml')
| -rw-r--r-- | addons/document/test/document_test2.yml | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/addons/document/test/document_test2.yml b/addons/document/test/document_test2.yml new file mode 100644 index 00000000000..712399afac3 --- /dev/null +++ b/addons/document/test/document_test2.yml @@ -0,0 +1,72 @@ +- + In order to test the document management +- + I make sure the default installation has some storage and root directory. +- + !assert {model: document.storage, id: storage_default }: + - id != False +- + !assert {model: document.directory, id: dir_root}: + - storage_id != False +- + I create a "Testing" folder where all the test data will go. +- + !record {model: document.directory, id: dir_tests }: + name: 'Testing' + parent_id: dir_root +- + I create an attachment into the root folder (w. empty fields, test that + defaults work) +- + !record {model: ir.attachment, id: file_test1 }: + name: Test file +- + I delete the attachment from the root folder +- + !delete {model: ir.attachment, id: file_test1, search: } +- + I create an attachment into the Testing folder. +- + !record {model: ir.attachment, id: file_test2 }: + name: Test file 2 + parent_id: dir_tests +- + I update the attachment with data, namely "abcd" +- + !record {model: ir.attachment, id: file_test2 }: + datas: "abcd" +- + I test that the datas of the attachment are correct +- + !assert {model: ir.attachment, id: file_test2 }: + - datas == "abcd\n" + - file_size == 5 + - file_type == 'text/plain' +- + I rename the attachment. +- + !record {model: ir.attachment, id: file_test2 }: + name: Test renamed 2 +- + I search the testing folder for attachments. +- + !python {model: ir.attachment}: | + ids = self.search(cr, uid, [('parent_id.name','=', 'Testing'), ('name','=','Test renamed 2')]) + assert ids == [ ref("file_test2") ], ids +- + I create an attachment to a 3rd resource, eg. a res.country +- + !record {model: ir.attachment, id: attach_3rd }: + name: 'Res country attachment.txt' + parent_id: dir_tests + datas: 'defg' + res_model: res.country + res_id: !eval ref("base.za") +- + I search for the res.country attachment +- + !python {model: ir.attachment}: | + ids = self.search(cr, uid, [('res_model', '=', 'res.country'), ('res_id', '=', ref("base.za"))]) + assert ids == [ ref("attach_3rd")], ids +- + !delete {model: ir.attachment, id: attach_3rd, search: } |
