Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test #2419

Closed

test #2419

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
9747759
refactor(models): change relationship for EnrollmentFlow and TransitA…
lalver1 Sep 25, 2024
89e3ecb
chore(fixtures): remove enrollment_methods field from transitagency f…
machikoyasuda Sep 25, 2024
1e7bbeb
test(fix): update enrollmentflow, agency changes on fixtures
machikoyasuda Sep 25, 2024
a612c47
fix(fixtures): add transit_agency_id to enrollmentflow
machikoyasuda Sep 25, 2024
3003f8c
chore(fixtures): remove (CST) from flow label
machikoyasuda Sep 25, 2024
6a219e8
chore(fixtures): give enrollmentflow label the human-readable name
machikoyasuda Sep 25, 2024
87a3e8e
test: update agency/flows relationship in tests
machikoyasuda Sep 25, 2024
3679734
fix(fixtures): remove digital, inperson only flows for now - breaking…
machikoyasuda Sep 25, 2024
e85b9fd
feat(admin): display agency, supported methods on enrollmentflow list
machikoyasuda Sep 26, 2024
ca98527
test(views): fix last test w/ mocked flow+session
machikoyasuda Sep 26, 2024
c9b7ec1
feat(migration): add data migration so existing flows have an agency
machikoyasuda Sep 26, 2024
3f4390c
refactor(migration): rename migration to a more descriptive title
machikoyasuda Sep 30, 2024
9296ce5
fix(fixtures): set transitagency directly with object, not id
machikoyasuda Sep 30, 2024
015e612
fix(tests): assign transit_agency directly, not by id
machikoyasuda Sep 30, 2024
55438d8
fix: remove old migration
machikoyasuda Sep 30, 2024
f72819f
refactor(db): re-word helptext for enrollmentflow label
machikoyasuda Sep 30, 2024
b07757a
feat(db): allow enrollmentflow.transit_agency to be null
machikoyasuda Sep 30, 2024
b2876ea
fix(migration): allow enrollmentflow's transit agency to be null, all…
machikoyasuda Sep 30, 2024
d1e2225
refactor(db): combine migration into 1 and add migrate_data()
machikoyasuda Sep 30, 2024
a32e5cb
feat(eligibility): filter flows in form by supported_enrollment_method
machikoyasuda Sep 27, 2024
00e1ea3
test: add specs for flows filtered by supported method
machikoyasuda Sep 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions benefits/core/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ def get_readonly_fields(self, request, obj=None):

@admin.register(models.EnrollmentFlow)
class SortableEnrollmentFlowAdmin(SortableAdminMixin, admin.ModelAdmin): # pragma: no cover
list_display = ("label", "transit_agency", "supported_enrollment_methods")

def get_exclude(self, request, obj=None):
if not request.user.is_superuser:
return [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Generated by Django 5.1 on 2024-09-30 23:25

import django.db.models.deletion
from django.db import migrations, models


def migrate_data(apps, schema_editor):
TransitAgency = apps.get_model("core", "TransitAgency")
for agency in TransitAgency.objects.all():
for flow in agency.enrollment_flows.all():
flow.transit_agency = agency
flow.save()


class Migration(migrations.Migration):

dependencies = [
("core", "0027_enrollmentflow_supported_methods"),
]

operations = [
migrations.AddField(
model_name="enrollmentflow",
name="transit_agency",
field=models.ForeignKey(
blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to="core.transitagency"
),
),
migrations.RunPython(migrate_data),
migrations.RemoveField(
model_name="transitagency",
name="enrollment_flows",
),
migrations.AlterField(
model_name="enrollmentflow",
name="label",
field=models.TextField(help_text="A human readable label, used as the display text in Admin.", null=True),
),
]
101 changes: 39 additions & 62 deletions benefits/core/migrations/local_fixtures.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,36 @@
"scheme": "dev-cal-itp_benefits"
}
},
{
"model": "core.transitagency",
"pk": 1,
"fields": {
"active": true,
"slug": "cst",
"short_name": "CST (local)",
"long_name": "California State Transit (local)",
"info_url": "https://www.agency-website.com",
"phone": "1-800-555-5555",
"index_template": "core/index--cst.html",
"eligibility_index_template": "eligibility/index--cst.html",
"eligibility_api_id": "cst",
"eligibility_api_private_key": 2,
"eligibility_api_public_key": 3,
"eligibility_api_jws_signing_alg": "RS256",
"transit_processor": 1,
"transit_processor_audience": "",
"transit_processor_client_id": "",
"transit_processor_client_secret_name": "cst-transit-processor-client-secret",
"staff_group": 2,
"customer_service_group": 2
}
},
{
"model": "core.enrollmentflow",
"pk": 1,
"fields": {
"system_name": "senior",
"label": "(CST) Senior Discount",
"label": "Older Adult",
"group_id": "group123",
"enrollment_success_template": "enrollment/success--cst.html",
"display_order": 2,
Expand All @@ -62,15 +86,16 @@
"eligibility_start_template": "eligibility/start--senior.html",
"claims_scope": "verify:senior",
"claims_claim": "senior",
"supported_enrollment_methods": ["digital", "in_person"]
"supported_enrollment_methods": ["digital", "in_person"],
"transit_agency": 1
}
},
{
"model": "core.enrollmentflow",
"pk": 2,
"fields": {
"system_name": "veteran",
"label": "(CST) Veteran Discount",
"label": "US Veteran",
"group_id": "group123",
"enrollment_success_template": "enrollment/success--cst.html",
"display_order": 4,
Expand All @@ -79,15 +104,16 @@
"eligibility_start_template": "eligibility/start--veteran.html",
"claims_scope": "verify:veteran",
"claims_claim": "veteran",
"supported_enrollment_methods": ["digital", "in_person"]
"supported_enrollment_methods": ["digital", "in_person"],
"transit_agency": 1
}
},
{
"model": "core.enrollmentflow",
"pk": 3,
"fields": {
"system_name": "agency_card",
"label": "(CST) Agency Card Discount",
"label": "Agency Card",
"group_id": "group123",
"enrollment_index_template": "enrollment/index--agency-card.html",
"enrollment_success_template": "enrollment/success--cst-agency-card.html",
Expand All @@ -104,15 +130,16 @@
"eligibility_form_class": "benefits.eligibility.forms.CSTAgencyCard",
"eligibility_unverified_template": "eligibility/unverified--cst-agency-card.html",
"help_template": "core/includes/help--cst-agency-card.html",
"supported_enrollment_methods": ["digital", "in_person"]
"supported_enrollment_methods": ["digital", "in_person"],
"transit_agency": 1
}
},
{
"model": "core.enrollmentflow",
"pk": 4,
"fields": {
"system_name": "calfresh",
"label": "(CST) CalFresh",
"label": "CalFresh Cardholder",
"group_id": "group123",
"supports_expiration": "True",
"expiration_days": 5,
Expand All @@ -126,15 +153,16 @@
"help_template": "core/includes/help--calfresh.html",
"claims_scope": "verify:calfresh",
"claims_claim": "calfresh",
"supported_enrollment_methods": ["digital", "in_person"]
"supported_enrollment_methods": ["digital", "in_person"],
"transit_agency": 1
}
},
{
"model": "core.enrollmentflow",
"pk": 5,
"fields": {
"system_name": "medicare",
"label": "(CST) Medicare Discount",
"label": "Medicare Cardholder",
"group_id": "group123",
"enrollment_success_template": "enrollment/success--cst.html",
"display_order": 1,
Expand All @@ -144,34 +172,8 @@
"help_template": "core/includes/help--medicare.html",
"claims_scope": "verify:medicare",
"claims_claim": "medicare",
"supported_enrollment_methods": ["digital", "in_person"]
}
},
{
"model": "core.enrollmentflow",
"pk": 6,
"fields": {
"system_name": "in_person_only",
"label": "(CST) In-person Only",
"group_id": "group123",
"supported_enrollment_methods": ["in_person"]
}
},
{
"model": "core.enrollmentflow",
"pk": 7,
"fields": {
"system_name": "digital_only",
"label": "(CST) Digital Only",
"group_id": "group123",
"enrollment_success_template": "enrollment/success--cst.html",
"display_order": 5,
"claims_provider": 1,
"selection_label_template": "eligibility/includes/selection-label--senior.html",
"eligibility_start_template": "eligibility/start--senior.html",
"claims_scope": "verify:senior",
"claims_claim": "senior",
"supported_enrollment_methods": ["digital"]
"supported_enrollment_methods": ["digital", "in_person"],
"transit_agency": 1
}
},
{
Expand All @@ -186,31 +188,6 @@
"portal_url": "https://www.transit-processor-portal.com"
}
},
{
"model": "core.transitagency",
"pk": 1,
"fields": {
"active": true,
"enrollment_flows": [1, 2, 3, 4, 5],
"slug": "cst",
"short_name": "CST (local)",
"long_name": "California State Transit (local)",
"info_url": "https://www.agency-website.com",
"phone": "1-800-555-5555",
"index_template": "core/index--cst.html",
"eligibility_index_template": "eligibility/index--cst.html",
"eligibility_api_id": "cst",
"eligibility_api_private_key": 2,
"eligibility_api_public_key": 3,
"eligibility_api_jws_signing_alg": "RS256",
"transit_processor": 1,
"transit_processor_audience": "",
"transit_processor_client_id": "",
"transit_processor_client_secret_name": "cst-transit-processor-client-secret",
"staff_group": 2,
"customer_service_group": 2
}
},
{
"model": "auth.Group",
"pk": 2,
Expand Down
Loading
Loading