2018-03-05 14:11:37 +00:00
|
|
|
import pytest
|
|
|
|
|
|
2018-03-07 15:42:59 +00:00
|
|
|
from app.letters.utils import get_bucket_prefix_for_notification
|
2018-03-05 14:11:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_get_bucket_prefix_for_notification_valid_notification(sample_notification):
|
|
|
|
|
|
|
|
|
|
bucket_prefix = get_bucket_prefix_for_notification(sample_notification)
|
|
|
|
|
|
|
|
|
|
assert bucket_prefix == '{folder}/NOTIFY.{reference}'.format(
|
|
|
|
|
folder=sample_notification.created_at.date(),
|
|
|
|
|
reference=sample_notification.reference
|
|
|
|
|
).upper()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_get_bucket_prefix_for_notification_invalid_notification():
|
|
|
|
|
with pytest.raises(AttributeError):
|
|
|
|
|
get_bucket_prefix_for_notification(None)
|