def test_slack_instance_should_update_with_task_returning_true(slack, mocker): mocker.patch('qcodes.utils.slack.active_loop', return_value=not None) slack.add_task('finished', channel='CH234') slack.update() task_added = slack.tasks[-1] assert 'Slack.check_msmt_finished' in str(task_added.func)
def test_slack_inst_should_add_unknown_task_command(mock_webclient, slack): slack.add_task('tcomm', channel='CH234') text = 'Task command tcomm not understood' expected_output = {'channel': 'CH234', 'text': text} mock_webclient.chat_postMessage.assert_called_with(**expected_output)
def test_slack_instance_should_update_with_task_returning_false(slack): slack.add_task('finished', channel='CH234') slack.update() assert slack.tasks == []