from unittest.mock import MagicMock, patch from garcon_contrib.aws import garcon_sns @patch.object(garcon_sns.boto3, "client") def test_sns_publish_message(client_mock, monkeypatch): """Verify sns sends expected subject/message/topic """ sns_mock = client_mock.return_value monkeypatch.setattr( sns_mock, 'publish', MagicMock(return_value=None)) garcon_sns.sns_publish_message( MagicMock(), topic='fake topic', message='hello message', subject='subject line') sns_mock.publish.assert_called_with( TopicArn='fake topic', Message='hello message', Subject='subject line')