Skip to content

Commit

Permalink
Use base class when patching to fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alechenninger committed Nov 16, 2024
1 parent 2595788 commit f1652bf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion tests/api/cross_access/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def test_expired_cross_account_requests_remove_bindings(self):
# Add roles to request for user 2222222 and approve it.
self.add_roles_to_request(self.request_4, [farmer, fisher])
with patch(
"api.cross_access.relation_api_dual_write_cross_access_handler.OutboxReplicator",
"management.group.relation_api_dual_write_subject_handler.OutboxReplicator",
new=partial(InMemoryRelationReplicator, self.relations),
):
self.approve_request(self.request_4)
Expand Down
6 changes: 3 additions & 3 deletions tests/management/group/test_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -1731,7 +1731,7 @@ def test_principal_get_ordering_nonusername_fail(self, mock_request):
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
self.assertEqual(principals, None)

@patch("management.group.relation_api_dual_write_group_handler.OutboxReplicator._save_replication_event")
@patch("management.group.relation_api_dual_write_subject_handler.OutboxReplicator._save_replication_event")
def test_add_group_roles_system_policy_create_success(self, mock_method):
"""Test that adding a role to a group without a system policy returns successfully."""
url = reverse("v1_management:group-roles", kwargs={"uuid": self.group.uuid})
Expand Down Expand Up @@ -3950,7 +3950,7 @@ def test_update_group_with_User_Access_Admin_success(self):
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(response.json()["name"], new_name_sa)

@patch("management.group.relation_api_dual_write_group_handler.OutboxReplicator._save_replication_event")
@patch("management.group.relation_api_dual_write_subject_handler.OutboxReplicator._save_replication_event")
def test_add_and_remove_role_to_group(self, mock_method):
Permission.objects.create(permission="app:inventory:read", tenant=self.tenant)

Expand Down Expand Up @@ -4009,7 +4009,7 @@ def assert_group_tuples(tuple_to_replicate):
assert_group_tuples(to_remove)
self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT)

@patch("management.group.relation_api_dual_write_group_handler.OutboxReplicator._save_replication_event")
@patch("management.group.relation_api_dual_write_subject_handler.OutboxReplicator._save_replication_event")
def test_add_and_remove_system_role_to_group(self, mock_method):
# Create a group with 'User Access administrator' role and add principals we use in headers
group_with_admin = self._create_group_with_user_access_administrator_role(self.tenant)
Expand Down

0 comments on commit f1652bf

Please sign in to comment.