From 34acf4d998394d204d517ffb4c35e0671f3dedb8 Mon Sep 17 00:00:00 2001 From: Jumana B Date: Mon, 9 Dec 2024 12:54:14 -0500 Subject: [PATCH] Set default limits to be higher (#2382) * Set default limits to be higher * fix test --- app/config.py | 4 +-- app/models.py | 4 +-- .../versions/0470_change_default_limit.py | 25 +++++++++++++++++++ tests/app/test_schemas.py | 4 +-- 4 files changed, 31 insertions(+), 6 deletions(-) create mode 100644 migrations/versions/0470_change_default_limit.py diff --git a/app/config.py b/app/config.py index 9e3edb0219..c220f7beed 100644 --- a/app/config.py +++ b/app/config.py @@ -585,8 +585,8 @@ class Config(object): "job": "{}-dvla-file-per-job".format(os.getenv("NOTIFY_ENVIRONMENT", "development")), "notification": "{}-dvla-letter-api-files".format(os.getenv("NOTIFY_ENVIRONMENT", "development")), } - SERVICE_ANNUAL_EMAIL_LIMIT = env.int("SERVICE_ANNUAL_EMAIL_LIMIT", 10_000_000) - SERVICE_ANNUAL_SMS_LIMIT = env.int("SERVICE_ANNUAL_SMS_LIMIT", 25_000) + SERVICE_ANNUAL_EMAIL_LIMIT = env.int("SERVICE_ANNUAL_EMAIL_LIMIT", 20_000_000) + SERVICE_ANNUAL_SMS_LIMIT = env.int("SERVICE_ANNUAL_SMS_LIMIT", 100_000) FREE_SMS_TIER_FRAGMENT_COUNT = 250000 diff --git a/app/models.py b/app/models.py index 2fe296a1d0..dd04d61bf2 100644 --- a/app/models.py +++ b/app/models.py @@ -65,8 +65,8 @@ DELIVERY_STATUS_CALLBACK_TYPE = "delivery_status" COMPLAINT_CALLBACK_TYPE = "complaint" SERVICE_CALLBACK_TYPES = [DELIVERY_STATUS_CALLBACK_TYPE, COMPLAINT_CALLBACK_TYPE] -DEFAULT_SMS_ANNUAL_LIMIT = 25000 -DEFAULT_EMAIL_ANNUAL_LIMIT = 10000000 +DEFAULT_SMS_ANNUAL_LIMIT = 100000 +DEFAULT_EMAIL_ANNUAL_LIMIT = 20000000 sms_sending_vehicles = db.Enum(*[vehicle.value for vehicle in SmsSendingVehicles], name="sms_sending_vehicles") diff --git a/migrations/versions/0470_change_default_limit.py b/migrations/versions/0470_change_default_limit.py new file mode 100644 index 0000000000..ea134dd165 --- /dev/null +++ b/migrations/versions/0470_change_default_limit.py @@ -0,0 +1,25 @@ +"""empty message + +Revision ID: 0470_change_default_limit +Revises: 0469_edit_emails +Create Date: 2016-06-01 14:17:01.963181 + +""" +revision = "0470_change_default_limit" +down_revision = "0469_edit_emails" + +from alembic import op + + +def upgrade(): + conn = op.get_bind() + conn.execute("ALTER TABLE services ALTER COLUMN email_annual_limit SET DEFAULT 20000000") + conn.execute("ALTER TABLE services ALTER COLUMN sms_annual_limit SET DEFAULT 100000") + conn.execute("UPDATE services SET email_annual_limit = 20000000 WHERE email_annual_limit = 10000000") + conn.execute("UPDATE services SET sms_annual_limit = 100000 WHERE sms_annual_limit = 25000") + + +def downgrade(): + conn = op.get_bind() + conn.execute("ALTER TABLE services ALTER COLUMN email_annual_limit SET DEFAULT 10000000") + conn.execute("ALTER TABLE services ALTER COLUMN sms_annual_limit SET DEFAULT 25000") diff --git a/tests/app/test_schemas.py b/tests/app/test_schemas.py index 36f1dfb1b9..000e82884c 100644 --- a/tests/app/test_schemas.py +++ b/tests/app/test_schemas.py @@ -149,5 +149,5 @@ def test_service_schema_returns_annual_limits(sample_service): data = service_schema.dump(sample_service) - assert data["sms_annual_limit"] == 25000 - assert data["email_annual_limit"] == 10000000 + assert data["sms_annual_limit"] == 100000 + assert data["email_annual_limit"] == 20000000