mirror of
https://github.com/GSA/notifications-api.git
synced 2026-09-10 10:03:38 -04:00
billing dao test
This commit is contained in:
@@ -136,8 +136,21 @@ def test_dao_get_annual_billing(mocker):
|
|||||||
result = dao_get_annual_billing(service_id)
|
result = dao_get_annual_billing(service_id)
|
||||||
mock_db_session.assert_called_once()
|
mock_db_session.assert_called_once()
|
||||||
stmt = mock_db_session.call_args[0][0]
|
stmt = mock_db_session.call_args[0][0]
|
||||||
print(f"stmt = {stmt}")
|
|
||||||
print(f"params = {stmt.compile().params}")
|
|
||||||
assert stmt.compile().params["service_id_1"] == service_id
|
assert stmt.compile().params["service_id_1"] == service_id
|
||||||
|
|
||||||
assert result == ["billing_entry1", "billing_entry2"]
|
assert result == ["billing_entry1", "billing_entry2"]
|
||||||
|
|
||||||
|
def test_dao_get_all_free_sms_fragment_limit(mocker):
|
||||||
|
mock_db_session = mocker.patch("app.dao.db.session.execute")
|
||||||
|
mock_db_session.return_value.scalars.return_value.all.return_value = ["sms_limit1", "sms_limit2"]
|
||||||
|
|
||||||
|
service_id = "test_service_id"
|
||||||
|
|
||||||
|
result = dao_get_all_free_sms_fragment_limit(service_id)
|
||||||
|
|
||||||
|
mock_db_session.assert_called_once()
|
||||||
|
|
||||||
|
stmt = mock_db_session.call_arg[0][0]
|
||||||
|
print(f"params = {stmt.compile().params}")
|
||||||
|
assert stmt.compile().params["service_id"] == service_id
|
||||||
|
assert result == ["sms_limit1", "sms_limit2"]
|
||||||
|
|||||||
Reference in New Issue
Block a user