Merge pull request #2157 from alphagov/fix-branding-request-org-info

Fix org info in branding requests with known orgs
This commit is contained in:
Chris Hill-Scott
2018-07-10 17:24:42 +01:00
committed by GitHub
3 changed files with 15 additions and 1 deletions

View File

@@ -986,7 +986,7 @@ def branding_request(service_id):
'\n---'
'\nBranding requested: {}'
).format(
AgreementInfo.from_current_user().as_human_readable,
AgreementInfo.from_current_user().as_info_for_branding_request,
current_service['name'],
url_for('main.service_dashboard', service_id=current_service['id'], _external=True),
branding_options_dict[form.options.data],

View File

@@ -473,6 +473,10 @@ class AgreementInfo:
else:
return 'Cant tell (domain is {})'.format(self._domain)
@property
def as_info_for_branding_request(self):
return self.owner or 'Cant tell (domain is {})'.format(self._domain)
@property
def as_jinja_template(self):
if self.crown_status is None:

View File

@@ -454,6 +454,16 @@ def test_get_valid_government_domain_gets_most_specific_first():
)
def test_get_domain_info_for_branding_request():
assert AgreementInfo("gov.uk").as_info_for_branding_request == (
'Cant tell (domain is gov.uk)'
)
assert AgreementInfo("dacorum.gov.uk").as_info_for_branding_request == (
'Dacorum Borough Council'
)
def test_validate_government_domain_data():
for domain in AgreementInfo.domains.keys():