mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-04 08:52:16 +02:00
Merge pull request #1683 from cisagov/za/1305-handle-www
(On getgov-backup) Ticket #1305: Handle www. in availablity check
This commit is contained in:
commit
ece81baac8
2 changed files with 9 additions and 0 deletions
|
@ -57,6 +57,9 @@ class DomainHelper:
|
|||
# If blank ok is true, just return the domain
|
||||
return domain
|
||||
|
||||
if domain.startswith("www."):
|
||||
domain = domain[4:]
|
||||
|
||||
if domain.endswith(".gov"):
|
||||
domain = domain[:-4]
|
||||
|
||||
|
|
|
@ -64,6 +64,12 @@ class TestFormValidation(MockEppLib):
|
|||
form = DotGovDomainForm(data={"requested_domain": "top-level-agency"})
|
||||
self.assertEqual(len(form.errors), 0)
|
||||
|
||||
def test_requested_domain_starting_www(self):
|
||||
"""Test a valid domain name with .www at the beginning."""
|
||||
form = DotGovDomainForm(data={"requested_domain": "www.top-level-agency"})
|
||||
self.assertEqual(len(form.errors), 0)
|
||||
self.assertEqual(form.cleaned_data["requested_domain"], "top-level-agency")
|
||||
|
||||
def test_requested_domain_ending_dotgov(self):
|
||||
"""Just a valid domain name with .gov at the end."""
|
||||
form = DotGovDomainForm(data={"requested_domain": "top-level-agency.gov"})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue