From 217d83f7104c2d0bc9b1a7a29bab3008cb2f2feb Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Thu, 6 Dec 2012 13:56:15 +0100 Subject: [PATCH] [IMP] mail: unlink test access rights bzr revid: chm@openerp.com-20121206125615-sdswn1fphlt4yarm --- addons/mail/tests/test_mail_access_rights.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/addons/mail/tests/test_mail_access_rights.py b/addons/mail/tests/test_mail_access_rights.py index adc073d1791..e110afc6b09 100644 --- a/addons/mail/tests/test_mail_access_rights.py +++ b/addons/mail/tests/test_mail_access_rights.py @@ -221,13 +221,20 @@ class test_mail_access_rights(test_mail_mockup.TestMailMockups): # Test: raoul is follower of the group he created self.assertEqual(set(group_doc.message_follower_ids), set([partner_raoul]), 'Create failed, the creator must follow the document he created.') - # Test: raoul modify the group + # Test: raoul can modify the group self.mail_group.write(cr, user_raoul_id, [group_doc_id], {'name': name2}) self.assertEqual(group_doc.name, name2, 'Write failed, the followers can modify the group.') # Test: bert try to modify the group but must raise self.assertRaises(except_orm, - self.mail_message.write, + self.mail_group.write, cr, user_bert_id, [group_doc_id], {'name': name2}) - # todo test unlink \ No newline at end of file + # Test: bert try to unlink the group but must raise + self.assertRaises(except_orm, + self.mail_group.unlink, + cr, user_bert_id, [group_doc_id]) + + # Test: bert can unlink the group + self.mail_group.unlink(cr, user_raoul_id, [group_doc_id]) + self.assertFalse(self.mail_group.search(cr, user_raoul_id, [["id", "=", group_doc_id]]), 'Unlink failed, the followers can unlink the group.')