Merge pull request #2756 from alphagov/clean-up-domains

Clean up domains file
This commit is contained in:
Chris Hill-Scott
2019-02-14 11:27:34 +00:00
committed by GitHub
4 changed files with 352 additions and 1037 deletions

View File

@@ -1,4 +1,4 @@
from collections import OrderedDict
from collections import Counter, OrderedDict
from csv import DictReader
from io import StringIO
from pathlib import Path
@@ -391,6 +391,11 @@ def test_get_domain_info_for_branding_request():
)
def test_domains_are_lowercased():
for domain in AgreementInfo.domains.keys():
assert domain == domain.lower()
def test_validate_government_domain_data():
for domain in AgreementInfo.domains.keys():
@@ -403,17 +408,25 @@ def test_validate_government_domain_data():
True, False, None
}
assert (
agreement_info.owner is None
) or (
isinstance(agreement_info.owner, str)
)
assert isinstance(agreement_info.owner, str) and agreement_info.owner.strip()
assert agreement_info.agreement_signed in {
True, False, None
}
def test_domain_data_is_canonicalized():
for owner, count in Counter(
AgreementInfo(domain).owner
for domain in AgreementInfo.domains.keys()
if AgreementInfo(domain).is_canonical
).most_common():
if count > 1:
raise ValueError(
'{} entries in domains.yml for {}'.format(count, owner)
)
def test_validate_email_domain_data():
for domain in GovernmentEmailDomain.domains.keys():