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

EnrollmentFlow: Add supported methods field #2375

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Generated by Django 5.1 on 2024-09-18 19:17

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("core", "0026_enrollmentevent"),
]

operations = [
migrations.AddField(
model_name="enrollmentflow",
name="supported_methods",
field=models.TextField(
choices=[("digital", "digital"), ("in_person", "in_person")],
default="",
help_text="If the flow is supported by digital, in-person, or both",
),
),
]
19 changes: 14 additions & 5 deletions benefits/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ def __str__(self) -> str:
return self.client_name


class EnrollmentMethods:
DIGITAL = "digital"
IN_PERSON = "in_person"


class EnrollmentFlow(models.Model):
"""Represents a user journey through the Benefits app for a single eligibility type."""

Expand Down Expand Up @@ -216,6 +221,15 @@ class EnrollmentFlow(models.Model):
enrollment_success_template = models.TextField(
default="enrollment/success.html", help_text="Template for a successful enrollment associated with the enrollment flow"
)
supported_methods = models.TextField(
choices={
EnrollmentMethods.DIGITAL: EnrollmentMethods.DIGITAL,
EnrollmentMethods.IN_PERSON: EnrollmentMethods.IN_PERSON,
f"{EnrollmentMethods.DIGITAL}, {EnrollmentMethods.IN_PERSON}": f"{EnrollmentMethods.DIGITAL} and {EnrollmentMethods.IN_PERSON}", # noqa: E501
},
default=EnrollmentMethods.DIGITAL,
help_text="If the flow is supported by digital enrollment, in-person enrollment, or both",
)

class Meta:
ordering = ["display_order"]
Expand Down Expand Up @@ -426,11 +440,6 @@ def for_user(user: User):
return None


class EnrollmentMethods:
DIGITAL = "digital"
IN_PERSON = "in_person"


class EnrollmentEvent(models.Model):
"""A record of a successful enrollment."""

Expand Down
7 changes: 7 additions & 0 deletions tests/pytest/core/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,13 @@ def test_EnrollmentFlow_enrollment_success_template():
assert new_flow.enrollment_success_template == "enrollment/success.html"


@pytest.mark.django_db
def test_EnrollmentFlow_supported_methods():
new_flow = EnrollmentFlow.objects.create()

assert new_flow.supported_methods == "digital"


class SampleFormClass:
"""A class for testing EligibilityVerificationForm references."""

Expand Down
Loading