def test_slack_inst_should_upload_latest_plot(mock_webclient, slack, mocker): method_name = 'qcodes.utils.slack.BasePlot.latest_plot' mocker.patch(method_name, return_value=not None) mocker.patch('os.remove') slack.upload_latest_plot(channel='CH234') expected_output = {'channels': 'CH234', 'file': AnyStringWith('.jpg')} mock_webclient.files_upload.assert_called_with(**expected_output)
def test_slack_inst_should_not_fail_upl_latest_wo_plot(mock_webclient, slack): slack.upload_latest_plot(channel='CH234') expected_output = {'channel': 'CH234', 'text': 'No latest plot'} mock_webclient.chat_postMessage.assert_called_with(**expected_output)