[IMP] mail: unlink test access rights
authorChristophe Matthieu <chm@openerp.com>
Thu, 6 Dec 2012 12:56:15 +0000 (13:56 +0100)
committerChristophe Matthieu <chm@openerp.com>
Thu, 6 Dec 2012 12:56:15 +0000 (13:56 +0100)
bzr revid: chm@openerp.com-20121206125615-sdswn1fphlt4yarm

addons/mail/tests/test_mail_access_rights.py

index adc073d..e110afc 100644 (file)
@@ -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.')