mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-06-10 22:44:47 +02:00
Fix merge, fix tests including phone numbers
This commit is contained in:
parent
b0debba4e6
commit
3f58f03bed
9 changed files with 36 additions and 31 deletions
|
@ -90,8 +90,8 @@ INSTALLED_APPS = [
|
|||
"widget_tweaks",
|
||||
# library for Finite State Machine statuses
|
||||
"django_fsm",
|
||||
# library for phone numbers
|
||||
"phonenumber_field",
|
||||
# library for phone numbers
|
||||
"phonenumber_field",
|
||||
# let's be sure to install our own application!
|
||||
"registrar",
|
||||
# Our internal API application
|
||||
|
@ -183,7 +183,7 @@ TEMPLATES = [
|
|||
},
|
||||
]
|
||||
|
||||
MESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage'
|
||||
MESSAGE_STORAGE = "django.contrib.messages.storage.session.SessionStorage"
|
||||
|
||||
# IS_DEMO_SITE controls whether or not we show our big red "TEST SITE" banner
|
||||
# underneath the "this is a real government website" banner.
|
||||
|
@ -301,7 +301,7 @@ USE_L10N = True
|
|||
USE_TZ = True
|
||||
|
||||
# setting for phonenumber library
|
||||
PHONENUMBER_DEFAULT_REGION="US"
|
||||
PHONENUMBER_DEFAULT_REGION = "US"
|
||||
|
||||
# endregion
|
||||
# region: Logging-----------------------------------------------------------###
|
||||
|
@ -375,7 +375,7 @@ LOGGING = {
|
|||
# Django's template processor
|
||||
"django.template": {
|
||||
"handlers": ["console"],
|
||||
"level": "DEBUG",
|
||||
"level": "INFO",
|
||||
},
|
||||
# Django's runserver
|
||||
"django.server": {
|
||||
|
@ -386,13 +386,13 @@ LOGGING = {
|
|||
# Django's runserver requests
|
||||
"django.request": {
|
||||
"handlers": ["django.server"],
|
||||
"level": "DEBUG",
|
||||
"level": "INFO",
|
||||
"propagate": False,
|
||||
},
|
||||
# OpenID Connect logger
|
||||
"oic": {
|
||||
"handlers": ["console"],
|
||||
"level": "DEBUG",
|
||||
"level": "INFO",
|
||||
},
|
||||
# Django wrapper for OpenID Connect
|
||||
"djangooidc": {
|
||||
|
|
|
@ -10,10 +10,9 @@ from django import forms
|
|||
from django.shortcuts import render
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||
from django.urls import resolve
|
||||
from django.core.validators import RegexValidator
|
||||
|
||||
from formtools.wizard.views import NamedUrlSessionWizardView # type: ignore
|
||||
from phonenumber_field.formfields import PhoneNumberField
|
||||
from phonenumber_field.formfields import PhoneNumberField # type: ignore
|
||||
|
||||
from registrar.models import Contact, DomainApplication, Domain
|
||||
|
||||
|
@ -238,7 +237,8 @@ class DotGovDomainForm(RegistrarForm):
|
|||
)
|
||||
if not Domain.string_could_be_domain(requested + ".gov"):
|
||||
raise forms.ValidationError(
|
||||
"Please enter a valid domain name using only letters, numbers, and hyphens",
|
||||
"Please enter a valid domain name using only letters, "
|
||||
"numbers, and hyphens",
|
||||
code="invalid",
|
||||
)
|
||||
return requested
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
# Generated by Django 4.1.4 on 2022-12-12 20:43
|
||||
# Generated by Django 4.1.4 on 2022-12-14 20:48
|
||||
|
||||
from django.db import migrations
|
||||
import phonenumber_field.modelfields
|
||||
import phonenumber_field.modelfields # type: ignore
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("registrar", "0004_domainapplication_federal_agency"),
|
||||
("registrar", "0005_domainapplication_city_and_more"),
|
||||
]
|
||||
|
||||
operations = [
|
|
@ -1,6 +1,6 @@
|
|||
from django.db import models
|
||||
|
||||
from phonenumber_field.modelfields import PhoneNumberField
|
||||
from phonenumber_field.modelfields import PhoneNumberField # type: ignore
|
||||
|
||||
|
||||
class Contact(models.Model):
|
||||
|
|
|
@ -34,11 +34,15 @@
|
|||
|
||||
{% input_with_errors wizard.form.address_line2 %}
|
||||
|
||||
{% input_with_errors wizard.form.city %}
|
||||
|
||||
{{ wizard.form.state_territory|add_label_class:"usa-label" }}
|
||||
{{ wizard.form.state_territory|add_class:"usa-select" }}
|
||||
|
||||
{% input_with_errors wizard.form.zipcode add_class="usa-input--small" %}
|
||||
|
||||
{% input_with_errors wizard.form.urbanization %}
|
||||
|
||||
</fieldset>
|
||||
|
||||
{{ block.super }}
|
||||
|
|
|
@ -2,5 +2,5 @@
|
|||
{{ contact.get_formatted_name }}<br />
|
||||
{% if contact.title %}{{ contact.title }}<br />{% endif %}
|
||||
{% if contact.email %}{{ contact.email }}<br />{% endif %}
|
||||
{% if contact.phone %}{{ contact.phone }}{% endif %}
|
||||
{% if contact.phone %}{{ contact.phone.as_national }}{% endif %}
|
||||
</address>
|
|
@ -5,7 +5,7 @@ from django import template
|
|||
register = template.Library()
|
||||
|
||||
|
||||
@register.inclusion_tag('includes/input_with_errors.html')
|
||||
@register.inclusion_tag("includes/input_with_errors.html")
|
||||
def input_with_errors(field, add_class=None):
|
||||
"""Make an input field along with error handling.
|
||||
|
||||
|
|
|
@ -49,7 +49,8 @@ class TestFormValidation(TestCase):
|
|||
self.assertEqual(
|
||||
form.errors["requested_domain"],
|
||||
[
|
||||
"Please enter a valid domain name using only letters, numbers, and hyphens"
|
||||
"Please enter a valid domain name using only letters, "
|
||||
"numbers, and hyphens"
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -105,14 +106,14 @@ class TestFormValidation(TestCase):
|
|||
"""Requirements box unchecked is an error."""
|
||||
form = RequirementsForm(data={})
|
||||
self.assertEqual(
|
||||
form.errors["is_policy_acknowledged"], ["You must read and agree to the .gov domain requirements to proceed."]
|
||||
form.errors["is_policy_acknowledged"],
|
||||
["You must read and agree to the .gov domain requirements to proceed."],
|
||||
)
|
||||
|
||||
def test_requirements_form_unchecked(self):
|
||||
"""Requirements box unchecked is an error."""
|
||||
form = RequirementsForm(data={"is_policy_acknowledged": False})
|
||||
self.assertEqual(
|
||||
form.errors["is_policy_acknowledged"], ["You must read and agree to the .gov domain requirements to proceed."]
|
||||
form.errors["is_policy_acknowledged"],
|
||||
["You must read and agree to the .gov domain requirements to proceed."],
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -222,7 +222,7 @@ 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"] = "(555) 555 5555"
|
||||
ao_form["authorizing_official-phone"] = "(201) 555 5555"
|
||||
|
||||
# test saving the page
|
||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||
|
@ -235,7 +235,7 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
|||
self.assertEquals(application.authorizing_official.last_name, "Tester ATO")
|
||||
self.assertEquals(application.authorizing_official.title, "Chief Tester")
|
||||
self.assertEquals(application.authorizing_official.email, "testy@town.com")
|
||||
self.assertEquals(application.authorizing_official.phone, "(555) 555 5555")
|
||||
self.assertEquals(application.authorizing_official.phone, "(201) 555 5555")
|
||||
|
||||
# test next button
|
||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||
|
@ -328,7 +328,7 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
|||
your_contact_form["your_contact-last_name"] = "Tester you"
|
||||
your_contact_form["your_contact-title"] = "Admin Tester"
|
||||
your_contact_form["your_contact-email"] = "testy-admin@town.com"
|
||||
your_contact_form["your_contact-phone"] = "(555) 555 5556"
|
||||
your_contact_form["your_contact-phone"] = "(201) 555 5556"
|
||||
|
||||
# test saving the page
|
||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||
|
@ -341,7 +341,7 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
|||
self.assertEquals(application.submitter.last_name, "Tester you")
|
||||
self.assertEquals(application.submitter.title, "Admin Tester")
|
||||
self.assertEquals(application.submitter.email, "testy-admin@town.com")
|
||||
self.assertEquals(application.submitter.phone, "(555) 555 5556")
|
||||
self.assertEquals(application.submitter.phone, "(201) 555 5556")
|
||||
|
||||
# test next button
|
||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||
|
@ -360,7 +360,7 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
|||
other_contacts_form["other_contacts-last_name"] = "Tester2"
|
||||
other_contacts_form["other_contacts-title"] = "Another Tester"
|
||||
other_contacts_form["other_contacts-email"] = "testy2@town.com"
|
||||
other_contacts_form["other_contacts-phone"] = "(555) 555 5557"
|
||||
other_contacts_form["other_contacts-phone"] = "(201) 555 5557"
|
||||
|
||||
# test saving the page
|
||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||
|
@ -375,7 +375,7 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
|||
last_name="Tester2",
|
||||
title="Another Tester",
|
||||
email="testy2@town.com",
|
||||
phone="(555) 555 5557",
|
||||
phone="(201) 555 5557",
|
||||
).count(),
|
||||
1,
|
||||
)
|
||||
|
@ -482,7 +482,7 @@ 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, "(555) 555 5555")
|
||||
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")
|
||||
|
@ -491,12 +491,12 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
|||
self.assertContains(review_page, "Tester you")
|
||||
self.assertContains(review_page, "Admin Tester")
|
||||
self.assertContains(review_page, "testy-admin@town.com")
|
||||
self.assertContains(review_page, "(555) 555 5556")
|
||||
self.assertContains(review_page, "(201) 555-5556")
|
||||
self.assertContains(review_page, "Testy2")
|
||||
self.assertContains(review_page, "Tester2")
|
||||
self.assertContains(review_page, "Another Tester")
|
||||
self.assertContains(review_page, "testy2@town.com")
|
||||
self.assertContains(review_page, "(555) 555 5557")
|
||||
self.assertContains(review_page, "(201) 555-5557")
|
||||
self.assertContains(review_page, "security@city.com")
|
||||
self.assertContains(review_page, "Nothing else.")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue