mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-02 16:02:15 +02:00
Fix some tests (more to come)
This commit is contained in:
parent
275ca470e8
commit
2f4c494df9
3 changed files with 14 additions and 13 deletions
|
@ -2924,6 +2924,7 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||
const select = document.getElementById(`id_${formPrefix}-sub_organization`);
|
||||
const suborgContainer = document.getElementById("suborganization-container");
|
||||
const suborgDetailsContainer = document.getElementById("suborganization-container__details");
|
||||
const otherContent = document.getElementById("bubblegum")?.value;
|
||||
if (!radios || !select || !suborgContainer || !suborgDetailsContainer) return;
|
||||
|
||||
// requestingSuborganization: This just broadly determines if they're requesting a suborg at all
|
||||
|
@ -2940,7 +2941,7 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||
|
||||
// Add fake "other" option to sub_organization select
|
||||
if (select && !Array.from(select.options).some(option => option.value === "other")) {
|
||||
select.add(new Option("Other (enter your organization manually)", "other"));
|
||||
select.add(new Option(otherContent, "other"));
|
||||
}
|
||||
|
||||
if (requestingNewSuborganization.value === "True") {
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
{% endblock %}
|
||||
|
||||
{% block form_fields %}
|
||||
<input id="bubblegum" class="display-none" value="Other (enter your suborganization manually)">
|
||||
<fieldset class="usa-fieldset">
|
||||
<legend>
|
||||
<h2>Who will use the domain you’re requesting?</h2>
|
||||
|
|
|
@ -677,18 +677,15 @@ class TestPortfolio(WebTest):
|
|||
@override_flag("organization_feature", active=True)
|
||||
@override_flag("organization_members", active=True)
|
||||
def test_cannot_view_members_table(self):
|
||||
"""Test that user without proper permission is denied access to members view"""
|
||||
"""Test that user without proper permission is denied access to members view."""
|
||||
|
||||
# Users can only view the members table if they have
|
||||
# Portfolio Permission "view_members" selected.
|
||||
# NOTE: Admins, by default, do NOT have permission
|
||||
# to view/edit members. This must be enabled explicitly
|
||||
# in the "additional permissions" section for a portfolio
|
||||
# permission.
|
||||
#
|
||||
# NOTE: Admins, by default, DO have permission
|
||||
# to view/edit members.
|
||||
# Scenarios to test include;
|
||||
# (1) - User is not admin and can view portfolio, but not the members table
|
||||
# (1) - User is admin and can view portfolio, but not the members table
|
||||
# (1) - User is admin and can view portfolio, as well as the members table
|
||||
|
||||
# --- non-admin
|
||||
self.app.set_user(self.user.username)
|
||||
|
@ -713,11 +710,9 @@ class TestPortfolio(WebTest):
|
|||
roles=[UserPortfolioRoleChoices.ORGANIZATION_ADMIN],
|
||||
)
|
||||
|
||||
# Verify that the user cannot access the members page
|
||||
# This will redirect the user to the members page.
|
||||
# Admins should have access to this page by default
|
||||
response = self.client.get(reverse("members"), follow=True)
|
||||
# Assert the response is a 403 Forbidden
|
||||
self.assertEqual(response.status_code, 403)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
@less_console_noise_decorator
|
||||
@override_flag("organization_feature", active=True)
|
||||
|
@ -940,6 +935,7 @@ class TestPortfolio(WebTest):
|
|||
portfolio=self.portfolio,
|
||||
roles=[UserPortfolioRoleChoices.ORGANIZATION_ADMIN],
|
||||
additional_permissions=[
|
||||
UserPortfolioPermissionChoices.EDIT_REQUESTS,
|
||||
UserPortfolioPermissionChoices.EDIT_MEMBERS,
|
||||
],
|
||||
)
|
||||
|
@ -1137,7 +1133,10 @@ class TestPortfolio(WebTest):
|
|||
"""Test the nav contains a dropdown with a link to create and another link to view requests
|
||||
Also test for the existence of the Create a new request btn on the requests page"""
|
||||
UserPortfolioPermission.objects.get_or_create(
|
||||
user=self.user, portfolio=self.portfolio, roles=[UserPortfolioRoleChoices.ORGANIZATION_ADMIN]
|
||||
user=self.user, portfolio=self.portfolio, roles=[UserPortfolioRoleChoices.ORGANIZATION_ADMIN],
|
||||
additional_permissions=[
|
||||
UserPortfolioPermissionChoices.EDIT_REQUESTS
|
||||
]
|
||||
)
|
||||
self.client.force_login(self.user)
|
||||
# create and submit a domain request
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue