Skip to content

Commit

Permalink
chore: revert unrelated commit
Browse files Browse the repository at this point in the history
This reverts commit 8b72bf9.
  • Loading branch information
Sepehr-Sobhani committed Dec 24, 2024
1 parent e090316 commit 5c81cd6
Showing 1 changed file with 2 additions and 18 deletions.
20 changes: 2 additions & 18 deletions bc_obps/common/tests/endpoints/auth/test_endpoint_permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ def test_endpoint_permissions_by_role(
mock_check_permission_for_role.reset_mock()

@classmethod
def get_all_api_endpoints_to_test(cls):
def test_all_api_endpoints_are_permission_tested(cls):
# these are the endpoints that we don't want to test
exclusion_list = [
"api-root",
Expand All @@ -430,23 +430,7 @@ def get_all_api_endpoints_to_test(cls):
"get_fuel_data",
]
all_url_patterns = get_resolver().url_patterns[1].url_patterns # index 1 is the API route
return [pattern.name for pattern in all_url_patterns if pattern.name not in exclusion_list]

@classmethod
def test_endpoint_protections_by_role(
cls,
# mock_check_permission_for_role: MagicMock,
):
valid_urls = cls.get_all_api_endpoints_to_test()
print(valid_urls)
for role, configs in cls.endpoints_to_test.items():
for config in configs:
print(role, config)

@classmethod
def test_all_api_endpoints_are_permission_tested(cls):
valid_urls = cls.get_all_api_endpoints_to_test()

valid_urls = [pattern.name for pattern in all_url_patterns if pattern.name not in exclusion_list]
# Flatten endpoints_to_test to extract all endpoint names that are permission-tested
tested_endpoints = {
item["endpoint_name"] for role, configs in cls.endpoints_to_test.items() for item in configs
Expand Down

0 comments on commit 5c81cd6

Please sign in to comment.