def test_no_additional_attachment(self): with self.tasks(): send_notification_as_slack(self.notification, [self.user], {}, {}) data = parse_qs(responses.calls[0].request.body) assert "attachments" in data assert data["text"][0] == "Notification Title" attachments = json.loads(data["attachments"][0]) assert len(attachments) == 1 assert attachments[0]["title"] == "My Title"
def test_additional_attachment(self): manager.attachment_generators[ExternalProviders.SLACK] = additional_attachment_generator with self.tasks(): send_notification_as_slack(self.notification, [self.user], {}, {}) data = parse_qs(responses.calls[0].request.body) assert "attachments" in data assert data["text"][0] == "Notification Title" attachments = json.loads(data["attachments"][0]) assert len(attachments) == 2 assert attachments[0]["title"] == "My Title" assert attachments[1]["title"] == self.organization.slug assert attachments[1]["text"] == self.integration.id
def send_notification(*args): args_list = list(args)[1:] send_notification_as_slack(*args_list, {})
def send_notification(*args): provider, *args_list = args if provider == ExternalProviders.SLACK: send_notification_as_slack(*args_list, {})