mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-14 23:15:06 +02:00
Final unit test
This commit is contained in:
parent
4830f5630f
commit
bdc03c66a9
2 changed files with 35 additions and 1 deletions
|
@ -22,6 +22,18 @@ This is using a custom implementation fieldset.html (see admin/fieldset.html)
|
||||||
<a href="#" class="other-contact__{{forloop.counter}}">{{ contact }}</a>{% if not forloop.last %}, {% endif %}
|
<a href="#" class="other-contact__{{forloop.counter}}">{{ contact }}</a>{% if not forloop.last %}, {% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
{% elif field.field.name == "current_websites" %}
|
||||||
|
{% comment %}
|
||||||
|
The "website" model is essentially just a text field.
|
||||||
|
It is not useful to be redirected to the object definition,
|
||||||
|
rather it is more useful in this scenario to be redirected to the
|
||||||
|
actual website (as its just a plaintext string otherwise).
|
||||||
|
|
||||||
|
This ONLY applies to analysts. For superusers, its business as usual.
|
||||||
|
{% endcomment %}
|
||||||
|
{% for website in field.contents|split:", " %}
|
||||||
|
<a href="{{ website }}" class="padding-top-1 current-website__{{forloop.counter}}">{{ website }}</a>{% if not forloop.last %}, {% endif %}
|
||||||
|
{% endfor %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class="readonly">{{ field.contents }}</div>
|
<div class="readonly">{{ field.contents }}</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -1247,7 +1247,29 @@ class TestDomainRequestAdmin(MockEppLib):
|
||||||
# Check that the page contains the link we expect.
|
# Check that the page contains the link we expect.
|
||||||
# Since the url is dynamic (populated by JS), we can test for its existence
|
# Since the url is dynamic (populated by JS), we can test for its existence
|
||||||
# by checking for the end tag.
|
# by checking for the end tag.
|
||||||
expected_url = f"Testy Tester</a>"
|
expected_url = "Testy Tester</a>"
|
||||||
|
self.assertContains(response, expected_url)
|
||||||
|
|
||||||
|
@less_console_noise_decorator
|
||||||
|
def test_other_websites_has_readonly_link(self):
|
||||||
|
"""Tests if the readonly other_websites field has links"""
|
||||||
|
|
||||||
|
# Create a fake domain request
|
||||||
|
domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.IN_REVIEW)
|
||||||
|
|
||||||
|
p = "userpass"
|
||||||
|
self.client.login(username="staffuser", password=p)
|
||||||
|
response = self.client.get(
|
||||||
|
"/admin/registrar/domainrequest/{}/change/".format(domain_request.pk),
|
||||||
|
follow=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
# Make sure the page loaded, and that we're on the right page
|
||||||
|
self.assertEqual(response.status_code, 200)
|
||||||
|
self.assertContains(response, domain_request.requested_domain.name)
|
||||||
|
|
||||||
|
# Check that the page contains the link we expect.
|
||||||
|
expected_url = '<a href="city.com" class="padding-top-1 current-website__1">city.com</a>'
|
||||||
self.assertContains(response, expected_url)
|
self.assertContains(response, expected_url)
|
||||||
|
|
||||||
@less_console_noise_decorator
|
@less_console_noise_decorator
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue