mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 09:51:11 -05:00
billing dao test
This commit is contained in:
@@ -3,6 +3,7 @@ from freezegun import freeze_time
|
|||||||
|
|
||||||
from app.dao.annual_billing_dao import (
|
from app.dao.annual_billing_dao import (
|
||||||
dao_create_or_update_annual_billing_for_year,
|
dao_create_or_update_annual_billing_for_year,
|
||||||
|
dao_get_annual_billing,
|
||||||
dao_get_free_sms_fragment_limit_for_year,
|
dao_get_free_sms_fragment_limit_for_year,
|
||||||
dao_update_annual_billing_for_future_years,
|
dao_update_annual_billing_for_future_years,
|
||||||
set_default_free_allowance_for_service,
|
set_default_free_allowance_for_service,
|
||||||
@@ -122,3 +123,19 @@ def test_set_default_free_allowance_for_service_updates_existing_year(sample_ser
|
|||||||
assert len(annual_billing) == 1
|
assert len(annual_billing) == 1
|
||||||
assert annual_billing[0].service_id == sample_service.id
|
assert annual_billing[0].service_id == sample_service.id
|
||||||
assert annual_billing[0].free_sms_fragment_limit == 150000
|
assert annual_billing[0].free_sms_fragment_limit == 150000
|
||||||
|
|
||||||
|
|
||||||
|
def test_dao_get_annual_billing(mocker):
|
||||||
|
mock_db_session = mocker.patch("app.dao.db.session.execute")
|
||||||
|
|
||||||
|
mock_db_session.return_value.scalars.return_value.all.return_value = [
|
||||||
|
"billing_entry1",
|
||||||
|
"billing_entry2",
|
||||||
|
]
|
||||||
|
service_id = "test_service_id"
|
||||||
|
result = dao_get_annual_billing(service_id)
|
||||||
|
mock_db_session.assert_called_once()
|
||||||
|
stmt = mock_db_session.call_args[0][0]
|
||||||
|
assert stmt.compile().params["service_id"] == service_id
|
||||||
|
|
||||||
|
assert result == ["billing_entry1", "billing_entry2"]
|
||||||
|
|||||||
Reference in New Issue
Block a user