Пример #1
0
 def test_respond_invitation_success(self, mock_save):
     user = UserNode()
     task = TaskInst()
     mock_has_task = HasTask(super_role=SUPER_ROLE.STANDARD, acceptance=ACCEPTANCE.WAITING)
     user.tasks.relationship = MagicMock(return_value=mock_has_task)
     user.respond_invitation(task, ACCEPTANCE.ACCEPT)
     self.assertEqual(ACCEPTANCE.ACCEPT, mock_has_task.acceptance)
Пример #2
0
 def test_change_task_owner(self):
     user1 = UserNode(uid='test_change_task_owner_1').save()
     task = user1.create_task('task')
     user2 = UserNode(uid='test_change_task_owner_2').save()
     user2.tasks.connect(task)
     with self.assertRaises(NotAccept):
         user1.change_super_role(task, user2, SUPER_ROLE.OWNER)
     user2.respond_invitation(task, ACCEPTANCE.ACCEPT)
     user1.change_super_role(task, user2, SUPER_ROLE.OWNER)
     user1_has_task = user1.tasks.relationship(task)
     user2_has_task = user2.tasks.relationship(task)
     self.assertEqual(SUPER_ROLE.ADMIN, user1_has_task.super_role)
     self.assertEqual(SUPER_ROLE.OWNER, user2_has_task.super_role)
Пример #3
0
 def test_respond_invitation_owner(self, mock_relationship):
     user = UserNode()
     task = TaskInst()
     with self.assertRaises(OwnerCannotChangeInvitation):
         user.respond_invitation(task, ACCEPTANCE.WAITING)