mirror of
https://github.com/GSA/notifications-api.git
synced 2026-09-11 10:28:55 -04:00
Updated the Provider stats and rates DAO objects to query based on the identifier in the ProviderDetails object.
- updated all tests - changed teardown to leave provider details rows on end of individual tests
This commit is contained in:
@@ -1,14 +1,17 @@
|
||||
from datetime import datetime
|
||||
from decimal import Decimal
|
||||
from app.dao.provider_rates_dao import create_provider_rates
|
||||
from app.models import ProviderRates
|
||||
from app.models import ProviderRates, ProviderDetails
|
||||
|
||||
|
||||
def test_create_provider_rates(notify_db, notify_db_session, mmg_provider_name):
|
||||
def test_create_provider_rates(notify_db, notify_db_session, mmg_provider):
|
||||
now = datetime.now()
|
||||
rate = Decimal("1.00000")
|
||||
create_provider_rates(mmg_provider_name, now, rate)
|
||||
|
||||
provider = ProviderDetails.query.filter_by(identifier=mmg_provider.identifier).one()
|
||||
|
||||
create_provider_rates(mmg_provider.identifier, now, rate)
|
||||
assert ProviderRates.query.count() == 1
|
||||
assert ProviderRates.query.first().rate == rate
|
||||
assert ProviderRates.query.first().valid_from == now
|
||||
assert ProviderRates.query.first().provider == mmg_provider_name
|
||||
assert ProviderRates.query.first().provider_id == provider.id
|
||||
|
||||
Reference in New Issue
Block a user