def test_complete(self): action_point = ActionPointFactory(status='pre_completed') mail.outbox = [] action_point.complete() self.assertEqual(len(mail.outbox), 1) self.assertEqual(mail.outbox[0].cc, [action_point.assigned_to.email])
def test_complete(self): action_point = ActionPointFactory(status='pre_completed') mail.outbox = [] action_point.complete() self.assertEqual(len(mail.outbox), 1) self.assertEqual(mail.outbox[0].cc, [action_point.assigned_to.email])
def test_author_complete(self): assigner = PMEUserFactory() action_point = ActionPointFactory(status='pre_completed', assigned_by=assigner) mail.outbox = [] action_point.complete(completed_by=assigner) self.assertEqual(len(mail.outbox), 1) self.assertEqual(mail.outbox[0].cc, [action_point.assigned_to.email]) email = mail.outbox[0] closed_by_sentence = '{} has closed the following action point:'.format(assigner.get_full_name()) self.assertIn(closed_by_sentence, email.body) self.assertIn(closed_by_sentence, email.alternatives[0][0])
def test_author_complete(self): assigner = PMEUserFactory() action_point = ActionPointFactory(status='pre_completed', assigned_by=assigner) mail.outbox = [] action_point.complete(completed_by=assigner) self.assertEqual(len(mail.outbox), 1) self.assertEqual(mail.outbox[0].cc, [action_point.assigned_to.email]) email = mail.outbox[0] closed_by_sentence = '{} has closed the following action point:'.format( assigner.get_full_name()) self.assertIn(closed_by_sentence, email.body) self.assertIn(closed_by_sentence, email.alternatives[0][0])
def test_additional_data(self): action_point = ActionPointFactory(status='pre_completed') initial_data = create_dict_with_relations(action_point) action_point.assigned_to = UserFactory() action_point.complete() action_point.save() author = UserFactory() create_snapshot(action_point, initial_data, author) self.assertEqual(action_point.history.count(), 1) snapshot = action_point.history.first() self.assertIn('key_events', snapshot.data) self.assertIn(ActionPoint.KEY_EVENTS.status_update, snapshot.data['key_events']) self.assertIn(ActionPoint.KEY_EVENTS.reassign, snapshot.data['key_events'])
def test_additional_data(self): action_point = ActionPointFactory(status='pre_completed') initial_data = create_dict_with_relations(action_point) action_point.assigned_to = UserFactory() action_point.complete() action_point.save() author = UserFactory() create_snapshot(action_point, initial_data, author) self.assertEqual(action_point.history.count(), 1) snapshot = action_point.history.first() self.assertIn('key_events', snapshot.data) self.assertIn(ActionPoint.KEY_EVENTS.status_update, snapshot.data['key_events']) self.assertIn(ActionPoint.KEY_EVENTS.reassign, snapshot.data['key_events'])
def test_completion_date(self): action_point = ActionPointFactory(status='pre_completed') self.assertIsNone(action_point.date_of_completion) action_point.complete() action_point.save() self.assertIsNotNone(action_point.date_of_completion)
def test_complete(self): action_point = ActionPointFactory(status='pre_completed') action_point.complete()
def test_complete_fail(self): action_point = ActionPointFactory() with self.assertRaisesRegex(ValidationError, "comments"): action_point.complete()
def test_completion_date(self): action_point = ActionPointFactory(status='pre_completed') self.assertIsNone(action_point.date_of_completion) action_point.complete() action_point.save() self.assertIsNotNone(action_point.date_of_completion)
def test_complete(self): action_point = ActionPointFactory(status='pre_completed') action_point.complete()
def test_complete_fail(self): action_point = ActionPointFactory() with self.assertRaisesRegex(ValidationError, "comments"): action_point.complete()