mirror of
https://github.com/GSA/notifications-api.git
synced 2026-09-11 10:28:55 -04:00
create entry when creating a new service
This commit is contained in:
@@ -1,8 +1,4 @@
|
||||
# from datetime import datetime, timedelta
|
||||
# import uuid
|
||||
# import functools
|
||||
# import pytest
|
||||
|
||||
from app.service.utils import get_current_financial_year_start_year
|
||||
from app.models import AnnualBilling
|
||||
from app.dao.annual_billing_dao import (
|
||||
dao_create_or_update_annual_billing_for_year,
|
||||
@@ -10,23 +6,13 @@ from app.dao.annual_billing_dao import (
|
||||
)
|
||||
|
||||
|
||||
def test_dao_create_get_free_sms_fragment_limit(notify_db_session, sample_service):
|
||||
years = [2015, 2016, 2017]
|
||||
free_limit_data = [1000, 2000, 3000]
|
||||
for i in range(0, len(years)):
|
||||
data = AnnualBilling(
|
||||
free_sms_fragment_limit=free_limit_data[i],
|
||||
financial_year_start=years[i],
|
||||
service_id=sample_service.id,
|
||||
)
|
||||
dao_create_or_update_annual_billing_for_year(data)
|
||||
def test_sample_service_has_free_sms_fragment_limit(notify_db_session, sample_service):
|
||||
|
||||
for i in range(0, len(years)):
|
||||
free_limit = dao_get_free_sms_fragment_limit_for_year(sample_service.id, years[i])
|
||||
free_limit = dao_get_free_sms_fragment_limit_for_year(sample_service.id, get_current_financial_year_start_year())
|
||||
|
||||
assert free_limit.free_sms_fragment_limit == free_limit_data[i]
|
||||
assert free_limit.financial_year_start == years[i]
|
||||
assert free_limit.service_id == sample_service.id
|
||||
assert free_limit.free_sms_fragment_limit == 250000
|
||||
assert free_limit.financial_year_start == get_current_financial_year_start_year()
|
||||
assert free_limit.service_id == sample_service.id
|
||||
|
||||
|
||||
def test_dao_update_free_sms_fragment_limit(notify_db_session, sample_service):
|
||||
|
||||
@@ -104,7 +104,7 @@ def test_cannot_create_two_services_with_same_name(sample_user):
|
||||
email_from="email_from1",
|
||||
message_limit=1000,
|
||||
restricted=False,
|
||||
created_by=sample_user)
|
||||
created_by=sample_user,)
|
||||
|
||||
service2 = Service(name="service_name",
|
||||
email_from="email_from2",
|
||||
@@ -171,7 +171,8 @@ def test_should_remove_user_from_service(sample_user):
|
||||
email_from="email_from",
|
||||
message_limit=1000,
|
||||
restricted=False,
|
||||
created_by=sample_user)
|
||||
created_by=sample_user,
|
||||
free_sms_fragment_limit=9999)
|
||||
dao_create_service(service, sample_user)
|
||||
new_user = User(
|
||||
name='Test User',
|
||||
|
||||
Reference in New Issue
Block a user