Files
notifications-api/tests/app/dao/test_rates_dao.py
Rebecca Law 43226dc932 Added a new rates table.
We only need one rate per channel. This reflects that. The provider_rates has been left for now, it is still not being used.
New dao has been added to select the right rate for the given notification_type and date of notificaiton.
2017-04-24 16:20:03 +01:00

19 lines
527 B
Python

from datetime import datetime
from decimal import Decimal
from app.dao.rates_dao import get_rate_for_type_and_date
def test_get_rate_for_type_and_date(notify_db):
rate = get_rate_for_type_and_date('sms', datetime.utcnow())
assert rate.rate == Decimal("1.58")
rate = get_rate_for_type_and_date('sms', datetime(2016, 6, 1))
assert rate.rate == Decimal("1.65")
def test_get_rate_for_type_and_date_early_date(notify_db):
rate = get_rate_for_type_and_date('sms', datetime(2014, 6, 1))
assert not rate