added logic to not display blue info box in certain condition, and added test

This commit is contained in:
David Kennedy 2024-11-18 13:51:39 -05:00
parent 9ee9e94405
commit 8f18a409ea
No known key found for this signature in database
GPG key ID: 6528A5386E66B96B
2 changed files with 37 additions and 14 deletions

View file

@ -58,7 +58,8 @@
{% include "includes/domain_dates.html" %}
{% if is_portfolio_admin and not is_domain_manager %}
{% if analyst_action != 'edit' or analyst_action_location != domain.pk %}
{% if is_portfolio_admin and not is_domain_manager and not is_analyst_managing_domain %}
<div class="usa-alert usa-alert--info usa-alert--slim">
<div class="usa-alert__body">
<p class="usa-alert__text ">
@ -66,7 +67,7 @@
</p>
</div>
</div>
{% elif is_portfolio_user and not is_domain_manager %}
{% elif is_portfolio_user and not is_domain_manager and not is_analyst_managing_domain %}
<div class="usa-alert usa-alert--info usa-alert--slim">
<div class="usa-alert__body">
<p class="usa-alert__text ">
@ -75,6 +76,7 @@
</div>
</div>
{% endif %}
{% endif %}
{% url 'domain-dns-nameservers' pk=domain.id as url %}

View file

@ -323,6 +323,27 @@ class TestDomainDetail(TestDomainOverview):
self.assertContains(detail_page, "noinformation.gov")
self.assertContains(detail_page, "Domain missing domain information")
def test_domain_detail_with_analyst_managing_domain(self):
"""Test that domain management page returns 200 and does not display
blue error message when an analyst is managing the domain"""
with less_console_noise():
# have to use staff user for this test
staff_user = create_user()
# staff_user.save()
self.client.force_login(staff_user)
# need to set the analyst_action and analyst_action_location
# in the session to emulate user clicking Manage Domain
# in the admin interface
session = self.client.session
session["analyst_action"] = "edit"
session["analyst_action_location"] = self.domain.id
session.save()
detail_page = self.client.get(reverse("domain", kwargs={"pk": self.domain.id}))
self.assertNotContains(detail_page, "To manage information for this domain, you must add yourself as a domain manager.")
@less_console_noise_decorator
@override_flag("organization_feature", active=True)
def test_domain_readonly_on_detail_page(self):