コード例 #1
0
ファイル: test_notificationevent.py プロジェクト: wjjmjh/quay
import pytest

from notifications.notificationevent import (
    BuildSuccessEvent,
    NotificationEvent,
    VulnerabilityFoundEvent,
)
from util.morecollections import AttrDict

from test.fixtures import *


@pytest.mark.parametrize("event_kind", NotificationEvent.event_names())
def test_create_notifications(event_kind):
    assert NotificationEvent.get_event(event_kind) is not None


@pytest.mark.parametrize("event_name", NotificationEvent.event_names())
def test_build_notification(event_name, initialized_db):
    # Create the notification event.
    found = NotificationEvent.get_event(event_name)
    sample_data = found.get_sample_data("foo", "bar", {"level": "low"})

    # Make sure all calls succeed.
    notification_data = {
        "performer_data": {},
    }

    found.get_level(sample_data, notification_data)
    found.get_summary(sample_data, notification_data)
    found.get_message(sample_data, notification_data)
コード例 #2
0
import pytest

from notifications.notificationevent import (BuildSuccessEvent,
                                             NotificationEvent,
                                             VulnerabilityFoundEvent)
from util.morecollections import AttrDict

from test.fixtures import *


@pytest.mark.parametrize('event_kind', NotificationEvent.event_names())
def test_create_notifications(event_kind):
    assert NotificationEvent.get_event(event_kind) is not None


@pytest.mark.parametrize('event_name', NotificationEvent.event_names())
def test_build_notification(event_name, initialized_db):
    # Create the notification event.
    found = NotificationEvent.get_event(event_name)
    sample_data = found.get_sample_data('foo', 'bar', {'level': 'low'})

    # Make sure all calls succeed.
    notification_data = {
        'performer_data': {},
    }

    found.get_level(sample_data, notification_data)
    found.get_summary(sample_data, notification_data)
    found.get_message(sample_data, notification_data)