mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-06-28 11:21:37 -04:00
fix org invite tests
This commit is contained in:
@@ -276,7 +276,9 @@ def set_up_your_profile():
|
||||
current_app.logger.info(f"#invites redirecting to {url}")
|
||||
return redirect(url)
|
||||
else:
|
||||
usr = User.from_id(user["id"])
|
||||
org_id = invite_data["organization"]
|
||||
usr.add_to_organization(org_id)
|
||||
url = url_for(".organization_dashboard", org_id=org_id)
|
||||
current_app.logger.info(f"#invites redirecting to {url}")
|
||||
return redirect(url)
|
||||
|
||||
@@ -259,7 +259,7 @@ class User(JSONModel, UserMixin):
|
||||
|
||||
# TODO this is sketch! Fix this!
|
||||
# This is temporary to restore org invite functionality only
|
||||
self.add_to_organization(org_id)
|
||||
# self.add_to_organization(org_id)
|
||||
value = self.belongs_to_organization(org_id)
|
||||
current_app.logger.debug(
|
||||
f"has_permissions returns org: {org_id} returning {value}"
|
||||
@@ -326,8 +326,8 @@ class User(JSONModel, UserMixin):
|
||||
|
||||
# TODO this is sketch! Fix this!
|
||||
# This is temporary to restore org invite functionality only
|
||||
if str(organization_id) not in self.organization_ids:
|
||||
self.add_to_organization(organization_id)
|
||||
# if str(organization_id) not in self.organization_ids:
|
||||
# self.add_to_organization(organization_id)
|
||||
return str(organization_id) in self.organization_ids
|
||||
|
||||
@property
|
||||
|
||||
@@ -19,15 +19,15 @@ from tests.conftest import (
|
||||
("user_services", "user_organizations", "expected_status", "organization_checked"),
|
||||
[
|
||||
([SERVICE_ONE_ID], [], 200, False),
|
||||
([SERVICE_ONE_ID, SERVICE_TWO_ID], [], 201, False),
|
||||
([], [ORGANISATION_ID], 202, True),
|
||||
([SERVICE_ONE_ID], [ORGANISATION_ID], 203, False),
|
||||
# ([], [], 403, True),
|
||||
# ([SERVICE_TWO_ID], [], 403, True),
|
||||
([SERVICE_TWO_ID], [ORGANISATION_ID], 204, True),
|
||||
([SERVICE_ONE_ID, SERVICE_TWO_ID], [ORGANISATION_ID], 205, False),
|
||||
# ([], [ORGANISATION_TWO_ID], 403, True),
|
||||
([], [ORGANISATION_ID, ORGANISATION_TWO_ID], 206, True),
|
||||
([SERVICE_ONE_ID, SERVICE_TWO_ID], [], 200, False),
|
||||
([], [ORGANISATION_ID], 200, True),
|
||||
([SERVICE_ONE_ID], [ORGANISATION_ID], 200, False),
|
||||
([], [], 403, True),
|
||||
([SERVICE_TWO_ID], [], 403, True),
|
||||
([SERVICE_TWO_ID], [ORGANISATION_ID], 200, True),
|
||||
([SERVICE_ONE_ID, SERVICE_TWO_ID], [ORGANISATION_ID], 200, False),
|
||||
([], [ORGANISATION_TWO_ID], 403, True),
|
||||
([], [ORGANISATION_ID, ORGANISATION_TWO_ID], 200, True),
|
||||
],
|
||||
)
|
||||
def test_services_pages_that_org_users_are_allowed_to_see(
|
||||
@@ -81,8 +81,8 @@ def test_services_pages_that_org_users_are_allowed_to_see(
|
||||
endpoint,
|
||||
service_id=SERVICE_ONE_ID,
|
||||
_expected_status=expected_status,
|
||||
nonce="nonce",
|
||||
state="state",
|
||||
nonce="dummy-nonce",
|
||||
state="dummy-state",
|
||||
)
|
||||
|
||||
assert mock_get_service.called is organization_checked
|
||||
|
||||
Reference in New Issue
Block a user