mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-17 23:14:11 +02:00
Fix test cases
This commit is contained in:
parent
a50462353f
commit
bb3e71380f
3 changed files with 35 additions and 14 deletions
|
@ -130,10 +130,14 @@ abbr[title] {
|
||||||
align-items: flex-end;
|
align-items: flex-end;
|
||||||
}
|
}
|
||||||
|
|
||||||
.usa-tooltip__body {
|
// Only apply this custom wrapping to desktop
|
||||||
|
@media (min-width: 768px) {
|
||||||
|
.usa-tooltip__body {
|
||||||
min-width: 320px;
|
min-width: 320px;
|
||||||
|
max-width: 350px;
|
||||||
|
white-space: normal;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// USWDS has weird interactions with SVGs regarding tooltips,
|
// USWDS has weird interactions with SVGs regarding tooltips,
|
||||||
// and other components. In this event, we need to disable pointer interactions.
|
// and other components. In this event, we need to disable pointer interactions.
|
||||||
.disable-pointer-events {
|
.disable-pointer-events {
|
||||||
|
|
|
@ -48,9 +48,7 @@
|
||||||
</th>
|
</th>
|
||||||
<td data-sort-value="{{ domain.expiration_date|date:"U" }}" data-label="Expires">{{ domain.expiration_date|date }}</td>
|
<td data-sort-value="{{ domain.expiration_date|date:"U" }}" data-label="Expires">{{ domain.expiration_date|date }}</td>
|
||||||
<td data-label="Status">
|
<td data-label="Status">
|
||||||
<span class="usa-tooltip no-click-outline cursor-help"
|
<span>
|
||||||
aria-ignore="true"
|
|
||||||
focusable="false">
|
|
||||||
{# UNKNOWN domains would not have an expiration date and thus would show 'Expired' #}
|
{# UNKNOWN domains would not have an expiration date and thus would show 'Expired' #}
|
||||||
{% if domain.is_expired and domain.state != domain.State.UNKNOWN %}
|
{% if domain.is_expired and domain.state != domain.State.UNKNOWN %}
|
||||||
Expired
|
Expired
|
||||||
|
|
|
@ -128,10 +128,6 @@ 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),
|
||||||
|
@ -139,16 +135,15 @@ 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.today()
|
||||||
test_domain.expiration_date = date(2011, 10, 10)
|
|
||||||
test_domain.save()
|
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
|
||||||
)
|
)
|
||||||
|
@ -167,6 +162,30 @@ class LoggedInTests(TestWithUser):
|
||||||
user_role.delete()
|
user_role.delete()
|
||||||
test_domain.delete()
|
test_domain.delete()
|
||||||
|
|
||||||
|
def test_state_help_text_expired(self):
|
||||||
|
"""Tests if each domain state has help text when expired"""
|
||||||
|
expired_text = (
|
||||||
|
"This domain has expired, but it is still online. "
|
||||||
|
"To renew this domain, contact help@get.gov."
|
||||||
|
)
|
||||||
|
test_domain, _ = Domain.objects.get_or_create(name="expired.gov", state=Domain.State.READY)
|
||||||
|
test_domain.expiration_date = date(2011, 10, 10)
|
||||||
|
test_domain.save()
|
||||||
|
|
||||||
|
UserDomainRole.objects.get_or_create(
|
||||||
|
user=self.user, domain=test_domain, role=UserDomainRole.Roles.MANAGER
|
||||||
|
)
|
||||||
|
|
||||||
|
# Grab the home page
|
||||||
|
response = self.client.get("/")
|
||||||
|
|
||||||
|
# Make sure the user can actually see the domain.
|
||||||
|
# We expect two instances because of SR content.
|
||||||
|
self.assertContains(response, "expired.gov", count=2)
|
||||||
|
|
||||||
|
# Check that we have the right text content.
|
||||||
|
self.assertContains(response, expired_text, count=1)
|
||||||
|
|
||||||
def test_home_deletes_withdrawn_domain_application(self):
|
def test_home_deletes_withdrawn_domain_application(self):
|
||||||
"""Tests if the user can delete a DomainApplication in the 'withdrawn' status"""
|
"""Tests if the user can delete a DomainApplication in the 'withdrawn' status"""
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue