Exemple #1
0
def test_formatting(certificate):
    from lemur.plugins.lemur_slack.plugin import create_expiration_attachments
    from lemur.notifications.service import _get_message_data
    data = [_get_message_data(certificate)]

    attachments = [
        {
            'title': 'certificate0',
            'color': 'danger',
            'fields': [
                {
                    'short': True,
                    'value': '*****@*****.**',
                    '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)
Exemple #2
0
def test_formatting(certificate):
    from lemur.plugins.lemur_slack.plugin import create_expiration_attachments
    from lemur.certificates.schemas import certificate_notification_output_schema
    data = [certificate_notification_output_schema.dump(certificate).data]

    attachment = {
        'title': certificate.name,
        'color': 'danger',
        'fields': [
            {
                'short': True,
                'value': '*****@*****.**',
                '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]
Exemple #3
0
def test_formatting(certificate):
    from lemur.plugins.lemur_slack.plugin import create_expiration_attachments
    from lemur.certificates.schemas import certificate_notification_output_schema
    data = [certificate_notification_output_schema.dump(certificate).data]

    attachment = {
        'title': certificate.name,
        'color': 'danger',
        'fields': [
            {
                'short': True,
                'value': '*****@*****.**',
                'title': 'Owner'
            },
            {
                'short': True,
                'value': u'Tuesday, December 31, 2047',
                '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]
Exemple #4
0
def test_formatting(certificate):
    from lemur.plugins.lemur_slack.plugin import create_expiration_attachments
    from lemur.notifications.service import _get_message_data
    data = [_get_message_data(certificate)]

    attachment = {
        'title':
        certificate.name,
        'color':
        'danger',
        'fields': [{
            'short': True,
            'value': '*****@*****.**',
            '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]
Exemple #5
0
def test_formatting(certificate):
    from lemur.plugins.lemur_slack.plugin import create_expiration_attachments
    from lemur.certificates.schemas import certificate_notification_output_schema

    data = [certificate_notification_output_schema.dump(certificate).data]

    attachment = {
        "title":
        certificate.name,
        "color":
        "danger",
        "fields": [
            {
                "short": True,
                "value": "*****@*****.**",
                "title": "Owner"
            },
            {
                "short": True,
                "value": u"Tuesday, December 31, 2047",
                "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]