mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-06-10 22:44:47 +02:00
Merge branch 'main' into es/2162-delete-submitter-v2
This commit is contained in:
commit
5c32a1922b
47 changed files with 1694 additions and 273 deletions
|
@ -18,12 +18,14 @@ from registrar.models import (
|
|||
User,
|
||||
Website,
|
||||
FederalAgency,
|
||||
Portfolio,
|
||||
UserPortfolioPermission,
|
||||
)
|
||||
from registrar.views.domain_request import DomainRequestWizard, Step
|
||||
|
||||
from .common import less_console_noise
|
||||
from .test_views import TestWithUser
|
||||
|
||||
from registrar.models.utility.portfolio_helper import UserPortfolioRoleChoices
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -2771,6 +2773,39 @@ class DomainRequestTestDifferentStatuses(TestWithUser, WebTest):
|
|||
response = self.client.get("/get-domain-requests-json/")
|
||||
self.assertContains(response, "Withdrawn")
|
||||
|
||||
@less_console_noise_decorator
|
||||
@override_flag("organization_feature", active=True)
|
||||
def test_domain_request_withdraw_portfolio_redirects_correctly(self):
|
||||
"""Tests that the withdraw button on portfolio redirects to the portfolio domain requests page"""
|
||||
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]
|
||||
)
|
||||
domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.SUBMITTED, user=self.user)
|
||||
domain_request.save()
|
||||
|
||||
detail_page = self.app.get(f"/domain-request/{domain_request.id}")
|
||||
self.assertContains(detail_page, "city.gov")
|
||||
self.assertContains(detail_page, "city1.gov")
|
||||
self.assertContains(detail_page, "Chief Tester")
|
||||
self.assertContains(detail_page, "testy@town.com")
|
||||
self.assertContains(detail_page, "Admin Tester")
|
||||
self.assertContains(detail_page, "Status:")
|
||||
# click the "Withdraw request" button
|
||||
mock_client = MockSESClient()
|
||||
with boto3_mocking.clients.handler_for("sesv2", mock_client):
|
||||
with less_console_noise():
|
||||
withdraw_page = detail_page.click("Withdraw request")
|
||||
self.assertContains(withdraw_page, "Withdraw request for")
|
||||
home_page = withdraw_page.click("Withdraw request")
|
||||
|
||||
# Assert that it redirects to the portfolio requests page and the status has been updated to withdrawn
|
||||
self.assertEqual(home_page.status_code, 302)
|
||||
self.assertEqual(home_page.location, reverse("domain-requests"))
|
||||
|
||||
response = self.client.get("/get-domain-requests-json/")
|
||||
self.assertContains(response, "Withdrawn")
|
||||
|
||||
@less_console_noise_decorator
|
||||
def test_domain_request_withdraw_no_permissions(self):
|
||||
"""Can't withdraw domain requests as a restricted user."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue