def test_remove_paralegal_from_case(add_user_to_case, remove_user_from_case): user = UserFactory() issue = IssueFactory(is_case_sent=True, paralegal=user, lawyer=UserFactory()) remove_user_from_case.assert_not_called() issue.paralegal = UserFactory() issue.save() remove_user_from_case.assert_called_once_with(user, issue)
def test_slack_not_dispatched_when_already_sent(mock_async): """ Ensure Slack message not sent twice. """ mock_async.assert_not_called() issue = IssueFactory(is_case_sent=True) issue.save() # Ensure only email task was dispatched mock_async.assert_has_calls([mock.call(send_issue_slack, str(issue.pk))])
def test_all_tasks_dispatched_when_complete(mock_async): """ Ensure all tasks are triggered when a new issue is first completed. """ mock_async.assert_not_called() issue = IssueFactory(is_alert_sent=False, is_case_sent=False) issue.save() # Ensure tasks were dispatched mock_async.assert_has_calls([mock.call(send_issue_slack, str(issue.pk))], )