Exemplo n.º 1
0
def test_find_notification_by_id(session, loop):
    """Assert the test can retrieve notification by id."""
    notification = NotificationModel(**NOTIFICATION_DATA[0])
    session.add(notification)
    session.commit()
    notification = session.merge(notification)

    result = loop.run_until_complete(
        NotifyService.find_notification(session, notification.id))
    assert result == notification
    assert result.id == NOTIFICATION_DATA[0]['id']
    assert result.recipients == NOTIFICATION_DATA[0]['recipients']
Exemplo n.º 2
0
def test_find_notification_by_id(session, loop):
    """Assert the test can retrieve notification by id."""
    notification = NotificationFactory.create_model(session, notification_info=NotificationFactory.Models.PENDING_1)
    content = ContentFactory.create_model(session, notification.id, content_info=ContentFactory.Models.CONTENT_1)
    AttachmentFactory.create_model(session, content.id, attachment_info=AttachmentFactory.Models.FILE_1)

    result = loop.run_until_complete(
        NotifyService.find_notification(session, notification.id)
    )

    assert result.id == NotificationFactory.Models.PENDING_1['id']
    assert result.recipients == NotificationFactory.Models.PENDING_1['recipients']
    assert result.content.subject == ContentFactory.Models.CONTENT_1['subject']
    assert result.content.attachments[0].file_name == AttachmentFactory.Models.FILE_1['file_name']