mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-06-12 07:24:48 +02:00
Add unit test for viewonly page
This commit is contained in:
parent
1a8d668fb5
commit
d56262be07
2 changed files with 40 additions and 1 deletions
|
@ -3025,3 +3025,40 @@ class TestWizardUnlockingSteps(TestWithUser, WebTest):
|
||||||
|
|
||||||
else:
|
else:
|
||||||
self.fail(f"Expected a redirect, but got a different response: {response}")
|
self.fail(f"Expected a redirect, but got a different response: {response}")
|
||||||
|
|
||||||
|
|
||||||
|
class TestPortfolioDomainRequestViewonly(TestWithUser, WebTest):
|
||||||
|
|
||||||
|
# Doesn't work with CSRF checking
|
||||||
|
# hypothesis is that CSRF_USE_SESSIONS is incompatible with WebTest
|
||||||
|
csrf_checks = False
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
super().setUp()
|
||||||
|
self.federal_agency, _ = FederalAgency.objects.get_or_create(agency="General Services Administration")
|
||||||
|
self.app.set_user(self.user.username)
|
||||||
|
self.TITLES = DomainRequestWizard.TITLES
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
super().tearDown()
|
||||||
|
DomainRequest.objects.all().delete()
|
||||||
|
DomainInformation.objects.all().delete()
|
||||||
|
self.federal_agency.delete()
|
||||||
|
|
||||||
|
@less_console_noise_decorator
|
||||||
|
@override_flag("organization_feature", active=True)
|
||||||
|
def test_domain_request_viewonly_displays_correct_fields(self):
|
||||||
|
"""Tests that the viewonly page displays different fields"""
|
||||||
|
portfolio, _ = Portfolio.objects.get_or_create(creator=self.user, organization_name="Test Portfolio")
|
||||||
|
UserPortfolioPermission.objects.get_or_create(
|
||||||
|
user=self.user, portfolio=portfolio, roles=[UserPortfolioRoleChoices.ORGANIZATION_ADMIN]
|
||||||
|
)
|
||||||
|
dummy_user, _ = User.objects.get_or_create(username="testusername123456")
|
||||||
|
domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.SUBMITTED, user=dummy_user)
|
||||||
|
domain_request.save()
|
||||||
|
|
||||||
|
detail_page = self.app.get(f"/domain-request/viewonly/{domain_request.id}")
|
||||||
|
self.assertContains(detail_page, "Requesting entity")
|
||||||
|
self.assertNotContains(detail_page, "Type of organization")
|
||||||
|
self.assertContains(detail_page, "city.gov")
|
||||||
|
self.assertContains(detail_page, "Status:")
|
|
@ -26,7 +26,6 @@ from .utility import (
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView):
|
class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView):
|
||||||
"""
|
"""
|
||||||
A common set of methods and configuration.
|
A common set of methods and configuration.
|
||||||
|
@ -43,6 +42,7 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView):
|
||||||
Any method not marked as internal can be overridden in a subclass,
|
Any method not marked as internal can be overridden in a subclass,
|
||||||
although not without consulting the base implementation, first.
|
although not without consulting the base implementation, first.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
StepEnum = Step
|
StepEnum = Step
|
||||||
template_name = ""
|
template_name = ""
|
||||||
|
|
||||||
|
@ -903,4 +903,6 @@ class PortfolioDomainRequestStatusViewOnly(DomainRequestPortfolioViewonlyView):
|
||||||
context["steps"] = request_step_list(wizard)
|
context["steps"] = request_step_list(wizard)
|
||||||
context["form_titles"] = wizard.TITLES
|
context["form_titles"] = wizard.TITLES
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
||||||
# endregion
|
# endregion
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue