mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-17 18:09:25 +02:00
made email readonly and fixed some unit tests
This commit is contained in:
parent
be43bbc8b7
commit
a7abfa9cdb
4 changed files with 5 additions and 4 deletions
|
@ -917,7 +917,7 @@ class ContactAdmin(ListHeaderAdmin, ImportExportModelAdmin):
|
||||||
name.admin_order_field = "first_name" # type: ignore
|
name.admin_order_field = "first_name" # type: ignore
|
||||||
|
|
||||||
# Read only that we'll leverage for CISA Analysts
|
# Read only that we'll leverage for CISA Analysts
|
||||||
analyst_readonly_fields: list[str] = []
|
analyst_readonly_fields: list[str] = ["email"]
|
||||||
|
|
||||||
def get_readonly_fields(self, request, obj=None):
|
def get_readonly_fields(self, request, obj=None):
|
||||||
"""Set the read-only state on form elements.
|
"""Set the read-only state on form elements.
|
||||||
|
|
|
@ -204,7 +204,7 @@ NameserverFormset = formset_factory(
|
||||||
|
|
||||||
|
|
||||||
class UserForm(forms.ModelForm):
|
class UserForm(forms.ModelForm):
|
||||||
"""Form for updating contacts."""
|
"""Form for updating users."""
|
||||||
|
|
||||||
email = forms.EmailField(max_length=None)
|
email = forms.EmailField(max_length=None)
|
||||||
|
|
||||||
|
|
|
@ -2105,6 +2105,7 @@ class TestDomainRequestAdmin(MockEppLib):
|
||||||
]
|
]
|
||||||
self.test_helper.assert_response_contains_distinct_values(response, expected_submitter_fields)
|
self.test_helper.assert_response_contains_distinct_values(response, expected_submitter_fields)
|
||||||
self.assertContains(response, "Testy2 Tester2")
|
self.assertContains(response, "Testy2 Tester2")
|
||||||
|
self.assertContains(response, "meoward.jones@igorville.gov")
|
||||||
|
|
||||||
# == Check for the senior_official == #
|
# == Check for the senior_official == #
|
||||||
self.assertContains(response, "testy@town.com", count=2)
|
self.assertContains(response, "testy@town.com", count=2)
|
||||||
|
@ -3130,6 +3131,7 @@ class TestDomainInformationAdmin(TestCase):
|
||||||
("phone", "(555) 123 12345"),
|
("phone", "(555) 123 12345"),
|
||||||
]
|
]
|
||||||
self.test_helper.assert_response_contains_distinct_values(response, expected_creator_fields)
|
self.test_helper.assert_response_contains_distinct_values(response, expected_creator_fields)
|
||||||
|
self.assertContains(response, "meoward.jones@igorville.gov")
|
||||||
|
|
||||||
# Check for the field itself
|
# Check for the field itself
|
||||||
self.assertContains(response, "Meoward Jones")
|
self.assertContains(response, "Meoward Jones")
|
||||||
|
@ -4036,7 +4038,7 @@ class TestContactAdmin(TestCase):
|
||||||
|
|
||||||
readonly_fields = self.admin.get_readonly_fields(request)
|
readonly_fields = self.admin.get_readonly_fields(request)
|
||||||
|
|
||||||
expected_fields = []
|
expected_fields = ["email"]
|
||||||
|
|
||||||
self.assertEqual(readonly_fields, expected_fields)
|
self.assertEqual(readonly_fields, expected_fields)
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,6 @@ class UserProfileView(UserProfilePermissionView, FormMixin):
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
"""Extend get_context_data to include has_profile_feature_flag"""
|
"""Extend get_context_data to include has_profile_feature_flag"""
|
||||||
context = super().get_context_data(**kwargs)
|
context = super().get_context_data(**kwargs)
|
||||||
logger.info("UserProfileView::get_context_data")
|
|
||||||
# This is a django waffle flag which toggles features based off of the "flag" table
|
# This is a django waffle flag which toggles features based off of the "flag" table
|
||||||
context["has_profile_feature_flag"] = flag_is_active(self.request, "profile_feature")
|
context["has_profile_feature_flag"] = flag_is_active(self.request, "profile_feature")
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue