mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-13 21:19:42 +02:00
Merge branch 'gd/2354-handle-portfolio-edit-mode' into za/2352-portfolio-user-can-view-and-update-suborgs
This commit is contained in:
commit
13f6986276
1 changed files with 48 additions and 2 deletions
|
@ -6,7 +6,7 @@ from django.urls import reverse
|
||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model
|
||||||
from waffle.testutils import override_flag
|
from waffle.testutils import override_flag
|
||||||
from api.tests.common import less_console_noise_decorator
|
from api.tests.common import less_console_noise_decorator
|
||||||
from registrar.models.utility.portfolio_helper import UserPortfolioRoleChoices
|
from registrar.models.utility.portfolio_helper import UserPortfolioPermissionChoices, UserPortfolioRoleChoices
|
||||||
from .common import MockEppLib, MockSESClient, create_user # type: ignore
|
from .common import MockEppLib, MockSESClient, create_user # type: ignore
|
||||||
from django_webtest import WebTest # type: ignore
|
from django_webtest import WebTest # type: ignore
|
||||||
import boto3_mocking # type: ignore
|
import boto3_mocking # type: ignore
|
||||||
|
@ -1161,7 +1161,7 @@ class TestDomainSeniorOfficial(TestDomainOverview):
|
||||||
|
|
||||||
# Add portfolio perms to the user object
|
# Add portfolio perms to the user object
|
||||||
self.user.portfolio = portfolio
|
self.user.portfolio = portfolio
|
||||||
self.user.portfolio_additional_permissions = [User.UserPortfolioPermissionChoices.VIEW_PORTFOLIO]
|
self.user.portfolio_additional_permissions = [UserPortfolioPermissionChoices.VIEW_PORTFOLIO]
|
||||||
self.user.save()
|
self.user.save()
|
||||||
self.user.refresh_from_db()
|
self.user.refresh_from_db()
|
||||||
|
|
||||||
|
@ -1574,6 +1574,52 @@ class TestDomainOrganization(TestDomainOverview):
|
||||||
self.assertNotEqual(self.domain_information.federal_agency, new_value)
|
self.assertNotEqual(self.domain_information.federal_agency, new_value)
|
||||||
|
|
||||||
|
|
||||||
|
class TestDomainSuborganization(TestDomainOverview):
|
||||||
|
"""Tests the Suborganization page for portfolio users"""
|
||||||
|
|
||||||
|
@less_console_noise_decorator
|
||||||
|
@override_flag("organization_feature", active=True)
|
||||||
|
def test_has_suborganization_field_on_overview_with_flag(self):
|
||||||
|
"""Ensures that the suborganization field is visible
|
||||||
|
and displays correctly on the domain overview page"""
|
||||||
|
|
||||||
|
# Create a portfolio
|
||||||
|
portfolio = Portfolio.objects.create(creator=self.user, organization_name="Ice Cream")
|
||||||
|
_suborg = Suborganization.objects.create(portfolio=portfolio, name="Vanilla")
|
||||||
|
|
||||||
|
# Add the portfolio to the domain_information object
|
||||||
|
self.domain_information.portfolio = portfolio
|
||||||
|
|
||||||
|
# Add a organization_name to test if the old value still displays
|
||||||
|
self.domain_information.organization_name = "Broccoli"
|
||||||
|
self.domain_information.save()
|
||||||
|
self.domain_information.refresh_from_db()
|
||||||
|
|
||||||
|
# Add portfolio perms to the user object
|
||||||
|
self.user.portfolio = portfolio
|
||||||
|
self.user.portfolio_additional_permissions = [UserPortfolioPermissionChoices.VIEW_PORTFOLIO]
|
||||||
|
self.user.save()
|
||||||
|
self.user.refresh_from_db()
|
||||||
|
|
||||||
|
# Navigate to the domain overview page
|
||||||
|
page = self.app.get(reverse("domain", kwargs={"pk": self.domain.id}))
|
||||||
|
|
||||||
|
# Test for the title change
|
||||||
|
self.assertContains(page, "Suborganization")
|
||||||
|
self.assertNotContains(page, "Organization name")
|
||||||
|
|
||||||
|
# Test for the good value
|
||||||
|
self.assertContains(page, "Ice Cream")
|
||||||
|
|
||||||
|
# Test for the bad value
|
||||||
|
self.assertNotContains(page, "Broccoli")
|
||||||
|
|
||||||
|
# Cleanup
|
||||||
|
self.domain_information.delete()
|
||||||
|
_suborg.delete()
|
||||||
|
portfolio.delete()
|
||||||
|
|
||||||
|
|
||||||
class TestDomainContactInformation(TestDomainOverview):
|
class TestDomainContactInformation(TestDomainOverview):
|
||||||
@less_console_noise_decorator
|
@less_console_noise_decorator
|
||||||
def test_domain_your_contact_information(self):
|
def test_domain_your_contact_information(self):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue