mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-31 01:33:56 +02:00
Add text for expired
This commit is contained in:
parent
9381ee3908
commit
24954ebdce
3 changed files with 25 additions and 3 deletions
|
@ -1425,8 +1425,17 @@ class Domain(TimeStampedModel, DomainHelper):
|
||||||
logger.info("able to transition to DNS_NEEDED state")
|
logger.info("able to transition to DNS_NEEDED state")
|
||||||
|
|
||||||
def get_state_help_text(self) -> str:
|
def get_state_help_text(self) -> str:
|
||||||
"""Returns a str containing additional information about a given state"""
|
"""Returns a str containing additional information about a given state.
|
||||||
help_text = Domain.State.get_help_text(self.state)
|
Returns custom content for when the domain itself is expired."""
|
||||||
|
if not self.is_expired():
|
||||||
|
help_text = Domain.State.get_help_text(self.state)
|
||||||
|
else:
|
||||||
|
# Given expired is not a physical state, but it is displayed as such,
|
||||||
|
# We need custom logic to determine this message.
|
||||||
|
help_text = (
|
||||||
|
"This domain has expired, but it is still online. "
|
||||||
|
"To renew this domain, contact help@get.gov."
|
||||||
|
)
|
||||||
return help_text
|
return help_text
|
||||||
|
|
||||||
def _disclose_fields(self, contact: PublicContact):
|
def _disclose_fields(self, contact: PublicContact):
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<div class="margin-top-4 tablet:grid-col-10">
|
<div class="margin-top-4 tablet:grid-col-10">
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class="usa-summary-box dotgov-status-box margin-top-3 padding-left-2{% if not domain.is_expired %}{% if domain.state == domain.State.UNKNOWN or domain.state == domain.State.DNS_NEEDED %} dotgov-status-box--action-need{% endif %}{% endif %}"
|
class="usa-summary-box dotgov-status-box padding-bottom-0 margin-top-3 padding-left-2{% if not domain.is_expired %}{% if domain.state == domain.State.UNKNOWN or domain.state == domain.State.DNS_NEEDED %} dotgov-status-box--action-need{% endif %}{% endif %}"
|
||||||
role="region"
|
role="region"
|
||||||
aria-labelledby="summary-box-key-information"
|
aria-labelledby="summary-box-key-information"
|
||||||
>
|
>
|
||||||
|
@ -25,6 +25,11 @@
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ domain.state|title }}
|
{{ domain.state|title }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if domain.get_state_help_text %}
|
||||||
|
<div class="padding-top-1 font-ui-xs">
|
||||||
|
{{ domain.get_state_help_text }}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -128,6 +128,10 @@ class LoggedInTests(TestWithUser):
|
||||||
"This domain has been removed and "
|
"This domain has been removed and "
|
||||||
"is no longer registered to your organization."
|
"is no longer registered to your organization."
|
||||||
)
|
)
|
||||||
|
expired_text = (
|
||||||
|
"This domain has expired, but it is still online. "
|
||||||
|
"To renew this domain, contact help@get.gov."
|
||||||
|
)
|
||||||
# Generate a mapping of domain names, the state, and expected messages for the subtest
|
# Generate a mapping of domain names, the state, and expected messages for the subtest
|
||||||
test_cases = [
|
test_cases = [
|
||||||
("deleted.gov", Domain.State.DELETED, deleted_text),
|
("deleted.gov", Domain.State.DELETED, deleted_text),
|
||||||
|
@ -135,12 +139,16 @@ class LoggedInTests(TestWithUser):
|
||||||
("unknown.gov", Domain.State.UNKNOWN, dns_needed_text),
|
("unknown.gov", Domain.State.UNKNOWN, dns_needed_text),
|
||||||
("onhold.gov", Domain.State.ON_HOLD, on_hold_text),
|
("onhold.gov", Domain.State.ON_HOLD, on_hold_text),
|
||||||
("ready.gov", Domain.State.READY, ready_text),
|
("ready.gov", Domain.State.READY, ready_text),
|
||||||
|
("expired.gov", Domain.State.READY, expired_text)
|
||||||
]
|
]
|
||||||
for domain_name, state, expected_message in test_cases:
|
for domain_name, state, expected_message in test_cases:
|
||||||
with self.subTest(domain_name=domain_name, state=state, expected_message=expected_message):
|
with self.subTest(domain_name=domain_name, state=state, expected_message=expected_message):
|
||||||
|
|
||||||
# Create a domain and a UserRole with the given params
|
# Create a domain and a UserRole with the given params
|
||||||
test_domain, _ = Domain.objects.get_or_create(name=domain_name, state=state)
|
test_domain, _ = Domain.objects.get_or_create(name=domain_name, state=state)
|
||||||
|
if domain_name == "expired.gov":
|
||||||
|
test_domain.expiration_date = date(2011, 10, 10)
|
||||||
|
test_domain.save()
|
||||||
user_role, _ = UserDomainRole.objects.get_or_create(
|
user_role, _ = UserDomainRole.objects.get_or_create(
|
||||||
user=self.user, domain=test_domain, role=UserDomainRole.Roles.MANAGER
|
user=self.user, domain=test_domain, role=UserDomainRole.Roles.MANAGER
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue