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.
This commit is contained in:
Rebecca Law
2017-04-24 16:20:03 +01:00
parent 028cedbb10
commit 43226dc932
5 changed files with 106 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
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