Skip to content

Commit

Permalink
Set default limits to be higher (#2382)
Browse files Browse the repository at this point in the history
* Set default limits to be higher

* fix test
  • Loading branch information
jzbahrai authored Dec 9, 2024
1 parent c566564 commit 34acf4d
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
25 changes: 25 additions & 0 deletions migrations/versions/0470_change_default_limit.py
Original file line number Diff line number Diff line change
@@ -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")
4 changes: 2 additions & 2 deletions tests/app/test_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 34acf4d

Please sign in to comment.