From d99681904e702eec809b36fec3a26398f8a0f405 Mon Sep 17 00:00:00 2001 From: kevgliss Date: Mon, 31 Oct 2016 17:02:08 -0700 Subject: [PATCH] Fixing test to take python3 into account. (#460) * Fixing test to take python3 into account. --- lemur/plugins/lemur_slack/tests/test_slack.py | 53 +++++++++---------- 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/lemur/plugins/lemur_slack/tests/test_slack.py b/lemur/plugins/lemur_slack/tests/test_slack.py index d9983ac9..b5d8dcfa 100644 --- a/lemur/plugins/lemur_slack/tests/test_slack.py +++ b/lemur/plugins/lemur_slack/tests/test_slack.py @@ -5,30 +5,29 @@ def test_formatting(certificate): from lemur.notifications.service import _get_message_data data = [_get_message_data(certificate)] - attachments = [ - { - 'title': 'certificate0', - 'color': 'danger', - 'fields': [ - { - 'short': True, - 'value': 'joe@example.com', - 'title': 'Owner' - }, - { - 'short': True, - 'value': u'Wednesday, January 1, 2020', - 'title': 'Expires' - }, { - 'short': True, - 'value': 0, - 'title': 'Endpoints Detected' - } - ], - 'title_link': 'https://lemur.example.com/#/certificates/certificate0', - 'mrkdwn_in': ['text'], - 'text': '', - 'fallback': '' - } - ] - assert attachments == create_expiration_attachments(data) + attachment = { + 'title': certificate.name, + 'color': 'danger', + 'fields': [ + { + 'short': True, + 'value': 'joe@example.com', + 'title': 'Owner' + }, + { + 'short': True, + 'value': u'Wednesday, January 1, 2020', + 'title': 'Expires' + }, { + 'short': True, + 'value': 0, + 'title': 'Endpoints Detected' + } + ], + 'title_link': 'https://lemur.example.com/#/certificates/{name}'.format(name=certificate.name), + 'mrkdwn_in': ['text'], + 'text': '', + 'fallback': '' + } + + assert attachment == create_expiration_attachments(data)[0]