Merge pull request #1515 from cisagov/rh/843-ao-removals

ISSUE #843: Authorizing Official Removal of middle name, phone #
This commit is contained in:
Rebecca H 2023-12-20 16:00:09 -08:00 committed by GitHub
commit 04b4ca355a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 3 additions and 30 deletions

View file

@ -329,10 +329,6 @@ class AuthorizingOfficialForm(RegistrarForm):
label="First name / given name",
error_messages={"required": ("Enter the first name / given name of your authorizing official.")},
)
middle_name = forms.CharField(
required=False,
label="Middle name (optional)",
)
last_name = forms.CharField(
label="Last name / family name",
error_messages={"required": ("Enter the last name / family name of your authorizing official.")},
@ -350,10 +346,6 @@ class AuthorizingOfficialForm(RegistrarForm):
label="Email",
error_messages={"invalid": ("Enter an email address in the required format, like name@example.com.")},
)
phone = PhoneNumberField(
label="Phone",
error_messages={"required": "Enter the phone number for your authorizing official."},
)
class CurrentSitesForm(RegistrarForm):

View file

@ -213,6 +213,9 @@ class AuthorizingOfficialContactForm(ContactForm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# Overriding bc phone not required in this form
self.fields["phone"] = forms.IntegerField(required=False)
# Set custom error messages
self.fields["first_name"].error_messages = {
"required": "Enter the first name / given name of your authorizing official."
@ -227,7 +230,6 @@ class AuthorizingOfficialContactForm(ContactForm):
self.fields["email"].error_messages = {
"required": "Enter an email address in the required format, like name@example.com."
}
self.fields["phone"].error_messages["required"] = "Enter a phone number for your authorizing official."
class DomainSecurityEmailForm(forms.Form):

View file

@ -25,17 +25,11 @@
{% input_with_errors forms.0.first_name %}
{% input_with_errors forms.0.middle_name %}
{% input_with_errors forms.0.last_name %}
{% input_with_errors forms.0.title %}
{% input_with_errors forms.0.email %}
{% with add_class="usa-input--medium" %}
{% input_with_errors forms.0.phone %}
{% endwith %}
</fieldset>
{% endblock %}

View file

@ -19,18 +19,12 @@
{% input_with_errors form.first_name %}
{% input_with_errors form.middle_name %}
{% input_with_errors form.last_name %}
{% input_with_errors form.title %}
{% input_with_errors form.email %}
{% input_with_errors form.phone %}
<button
type="submit"
class="usa-button"

View file

@ -196,11 +196,6 @@ class TestFormValidation(MockEppLib):
["Response must be less than 1000 characters."],
)
def test_authorizing_official_phone_invalid(self):
"""Must be a valid phone number."""
form = AuthorizingOfficialForm(data={"phone": "boss@boss"})
self.assertTrue(form.errors["phone"][0].startswith("Enter a valid phone number "))
def test_your_contact_email_invalid(self):
"""must be a valid email address."""
form = YourContactForm(data={"email": "boss@boss"})

View file

@ -257,7 +257,6 @@ class DomainApplicationTests(TestWithUser, WebTest):
ao_form["authorizing_official-last_name"] = "Tester ATO"
ao_form["authorizing_official-title"] = "Chief Tester"
ao_form["authorizing_official-email"] = "testy@town.com"
ao_form["authorizing_official-phone"] = "(201) 555 5555"
# test next button
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
@ -268,7 +267,6 @@ class DomainApplicationTests(TestWithUser, WebTest):
self.assertEqual(application.authorizing_official.last_name, "Tester ATO")
self.assertEqual(application.authorizing_official.title, "Chief Tester")
self.assertEqual(application.authorizing_official.email, "testy@town.com")
self.assertEqual(application.authorizing_official.phone, "(201) 555 5555")
# the post request should return a redirect to the next form in
# the application
self.assertEqual(ao_result.status_code, 302)
@ -458,7 +456,6 @@ class DomainApplicationTests(TestWithUser, WebTest):
self.assertContains(review_page, "Tester ATO")
self.assertContains(review_page, "Chief Tester")
self.assertContains(review_page, "testy@town.com")
self.assertContains(review_page, "(201) 555-5555")
self.assertContains(review_page, "city.com")
self.assertContains(review_page, "city.gov")
self.assertContains(review_page, "city1.gov")
@ -886,7 +883,6 @@ class DomainApplicationTests(TestWithUser, WebTest):
ao_form["authorizing_official-last_name"] = "Tester ATO"
ao_form["authorizing_official-title"] = "Chief Tester"
ao_form["authorizing_official-email"] = "testy@town.com"
ao_form["authorizing_official-phone"] = "(201) 555 5555"
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
ao_result = ao_form.submit()