class TestSNSOutput(object): """Test class for SNSOutput""" DESCRIPTOR = 'unit_test_topic' SERVICE = 'aws-sns' def setup(self): """Create the dispatcher and the mock SNS topic.""" self._dispatcher = SNSOutput(REGION, ACCOUNT_ID, FUNCTION_NAME, CONFIG) topic_name = CONFIG[self.SERVICE][self.DESCRIPTOR] boto3.client('sns', region_name=REGION).create_topic(Name=topic_name) @patch('logging.Logger.info') def test_dispatch(self, log_mock): """SNSOutput - Dispatch Success""" assert_true(self._dispatcher.dispatch(get_alert(), self.DESCRIPTOR)) log_mock.assert_called_with('Successfully sent alert to %s:%s', self.SERVICE, self.DESCRIPTOR)
class TestSNSOutput(object): """Test class for SNSOutput""" DESCRIPTOR = 'unit_test_topic' SERVICE = 'aws-sns' OUTPUT = ':'.join([SERVICE, DESCRIPTOR]) @patch.dict('os.environ', MOCK_ENV) def setup(self): """Create the dispatcher and the mock SNS topic.""" self._dispatcher = SNSOutput(CONFIG) topic_name = CONFIG[self.SERVICE][self.DESCRIPTOR] boto3.client('sns', region_name=REGION).create_topic(Name=topic_name) @patch('logging.Logger.info') def test_dispatch(self, log_mock): """SNSOutput - Dispatch Success""" assert_true(self._dispatcher.dispatch(get_alert(), self.OUTPUT)) log_mock.assert_called_with('Successfully sent alert to %s:%s', self.SERVICE, self.DESCRIPTOR)
def setup(self): """Create the dispatcher and the mock SNS topic.""" self._dispatcher = SNSOutput(CONFIG) topic_name = CONFIG[self.SERVICE][self.DESCRIPTOR] boto3.client('sns', region_name=REGION).create_topic(Name=topic_name)