mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-22 10:46:06 +02:00
Merge pull request #1515 from cisagov/rh/843-ao-removals
ISSUE #843: Authorizing Official Removal of middle name, phone #
This commit is contained in:
commit
04b4ca355a
6 changed files with 3 additions and 30 deletions
|
@ -329,10 +329,6 @@ class AuthorizingOfficialForm(RegistrarForm):
|
||||||
label="First name / given name",
|
label="First name / given name",
|
||||||
error_messages={"required": ("Enter the first name / given name of your authorizing official.")},
|
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(
|
last_name = forms.CharField(
|
||||||
label="Last name / family name",
|
label="Last name / family name",
|
||||||
error_messages={"required": ("Enter the last name / family name of your authorizing official.")},
|
error_messages={"required": ("Enter the last name / family name of your authorizing official.")},
|
||||||
|
@ -350,10 +346,6 @@ class AuthorizingOfficialForm(RegistrarForm):
|
||||||
label="Email",
|
label="Email",
|
||||||
error_messages={"invalid": ("Enter an email address in the required format, like name@example.com.")},
|
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):
|
class CurrentSitesForm(RegistrarForm):
|
||||||
|
|
|
@ -213,6 +213,9 @@ class AuthorizingOfficialContactForm(ContactForm):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super().__init__(*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
|
# Set custom error messages
|
||||||
self.fields["first_name"].error_messages = {
|
self.fields["first_name"].error_messages = {
|
||||||
"required": "Enter the first name / given name of your authorizing official."
|
"required": "Enter the first name / given name of your authorizing official."
|
||||||
|
@ -227,7 +230,6 @@ class AuthorizingOfficialContactForm(ContactForm):
|
||||||
self.fields["email"].error_messages = {
|
self.fields["email"].error_messages = {
|
||||||
"required": "Enter an email address in the required format, like name@example.com."
|
"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):
|
class DomainSecurityEmailForm(forms.Form):
|
||||||
|
|
|
@ -25,17 +25,11 @@
|
||||||
|
|
||||||
{% input_with_errors forms.0.first_name %}
|
{% 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.last_name %}
|
||||||
|
|
||||||
{% input_with_errors forms.0.title %}
|
{% input_with_errors forms.0.title %}
|
||||||
|
|
||||||
{% input_with_errors forms.0.email %}
|
{% input_with_errors forms.0.email %}
|
||||||
|
|
||||||
{% with add_class="usa-input--medium" %}
|
|
||||||
{% input_with_errors forms.0.phone %}
|
|
||||||
{% endwith %}
|
|
||||||
|
|
||||||
</fieldset>
|
</fieldset>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -19,18 +19,12 @@
|
||||||
|
|
||||||
{% input_with_errors form.first_name %}
|
{% input_with_errors form.first_name %}
|
||||||
|
|
||||||
{% input_with_errors form.middle_name %}
|
|
||||||
|
|
||||||
{% input_with_errors form.last_name %}
|
{% input_with_errors form.last_name %}
|
||||||
|
|
||||||
{% input_with_errors form.title %}
|
{% input_with_errors form.title %}
|
||||||
|
|
||||||
{% input_with_errors form.email %}
|
{% input_with_errors form.email %}
|
||||||
|
|
||||||
{% input_with_errors form.phone %}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
class="usa-button"
|
class="usa-button"
|
||||||
|
|
|
@ -196,11 +196,6 @@ class TestFormValidation(MockEppLib):
|
||||||
["Response must be less than 1000 characters."],
|
["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):
|
def test_your_contact_email_invalid(self):
|
||||||
"""must be a valid email address."""
|
"""must be a valid email address."""
|
||||||
form = YourContactForm(data={"email": "boss@boss"})
|
form = YourContactForm(data={"email": "boss@boss"})
|
||||||
|
|
|
@ -257,7 +257,6 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
||||||
ao_form["authorizing_official-last_name"] = "Tester ATO"
|
ao_form["authorizing_official-last_name"] = "Tester ATO"
|
||||||
ao_form["authorizing_official-title"] = "Chief Tester"
|
ao_form["authorizing_official-title"] = "Chief Tester"
|
||||||
ao_form["authorizing_official-email"] = "testy@town.com"
|
ao_form["authorizing_official-email"] = "testy@town.com"
|
||||||
ao_form["authorizing_official-phone"] = "(201) 555 5555"
|
|
||||||
|
|
||||||
# test next button
|
# test next button
|
||||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
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.last_name, "Tester ATO")
|
||||||
self.assertEqual(application.authorizing_official.title, "Chief Tester")
|
self.assertEqual(application.authorizing_official.title, "Chief Tester")
|
||||||
self.assertEqual(application.authorizing_official.email, "testy@town.com")
|
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 post request should return a redirect to the next form in
|
||||||
# the application
|
# the application
|
||||||
self.assertEqual(ao_result.status_code, 302)
|
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, "Tester ATO")
|
||||||
self.assertContains(review_page, "Chief Tester")
|
self.assertContains(review_page, "Chief Tester")
|
||||||
self.assertContains(review_page, "testy@town.com")
|
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.com")
|
||||||
self.assertContains(review_page, "city.gov")
|
self.assertContains(review_page, "city.gov")
|
||||||
self.assertContains(review_page, "city1.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-last_name"] = "Tester ATO"
|
||||||
ao_form["authorizing_official-title"] = "Chief Tester"
|
ao_form["authorizing_official-title"] = "Chief Tester"
|
||||||
ao_form["authorizing_official-email"] = "testy@town.com"
|
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)
|
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||||
ao_result = ao_form.submit()
|
ao_result = ao_form.submit()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue