Skip to content

Commit 72533e1

Browse files
fregataaclaude
andcommitted
fix(BA-4525): Update scope adapter/handler tests for GLOBAL removal
- Change GLOBAL scope adapter test to verify NotImplementedError is raised - Fix search_scopes handler test to assert on element_type instead of scope_type Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 966cf2e commit 72533e1

2 files changed

Lines changed: 9 additions & 23 deletions

File tree

tests/unit/manager/api/rbac/test_scope_adapter.py

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -216,31 +216,17 @@ def test_build_querier_user_scope(self, adapter: ScopeAdapter) -> None:
216216

217217
assert len(querier.conditions) == 1
218218

219-
def test_build_querier_global_scope(self, adapter: ScopeAdapter) -> None:
220-
"""Test building querier for global scope returns empty querier."""
221-
limit = 10
222-
offset = 0
219+
def test_build_querier_global_scope_raises(self, adapter: ScopeAdapter) -> None:
220+
"""Test building querier for global scope raises NotImplementedError."""
223221
request = SearchScopesRequest(
224-
filter=ScopeFilter(
225-
name=StringFilter(
226-
i_contains="anything",
227-
)
228-
),
229-
order=[
230-
ScopeOrder(
231-
field=ScopeOrderField.NAME,
232-
direction=OrderDirection.ASC,
233-
)
234-
],
235-
limit=limit,
236-
offset=offset,
222+
filter=None,
223+
order=[],
224+
limit=10,
225+
offset=0,
237226
)
238227

239-
querier = adapter.build_querier(ScopeType.GLOBAL, request)
240-
241-
# Global scope ignores filters and orders
242-
assert querier.conditions == []
243-
assert querier.orders == []
228+
with pytest.raises(NotImplementedError):
229+
adapter.build_querier(ScopeType.GLOBAL, request)
244230

245231

246232
class TestScopeAdapterConvertToDTO:

tests/unit/manager/api/rbac/test_scope_handlers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ async def test_search_scopes_calls_processor_with_action(
257257
mock_permission_controller.search_scopes.wait_for_complete.assert_called_once()
258258
call_args = mock_permission_controller.search_scopes.wait_for_complete.call_args
259259
action = call_args[0][0]
260-
assert action.scope_type == self.TEST_SCOPE_TYPE
260+
assert action.element_type == self.TEST_SCOPE_TYPE.to_element()
261261

262262
async def test_search_scopes_rejects_non_superadmin(
263263
self,

0 commit comments

Comments
 (0)