diff --git a/backend/lcfs/tests/test_organization.py b/backend/lcfs/tests/test_organization.py index 6f88049b7..3e8046be4 100644 --- a/backend/lcfs/tests/test_organization.py +++ b/backend/lcfs/tests/test_organization.py @@ -71,10 +71,10 @@ async def test_get_organization_by_id_bceid_user( @pytest.mark.anyio async def test_create_organization_success( - client: AsyncClient, fastapi_app: FastAPI, mock_user_role + client: AsyncClient, fastapi_app: FastAPI, set_mock_user ) -> None: # Set mock user role for organization creation - mock_user_role([RoleEnum.GOVERNMENT]) + set_mock_user(fastapi_app, [RoleEnum.GOVERNMENT]) payload = { "name": "Test Organizationa", "operatingName": "Test Operating name", @@ -108,13 +108,12 @@ async def test_create_organization_success( assert response.status_code == status.HTTP_201_CREATED - @pytest.mark.anyio async def test_update_organization_success( - client: AsyncClient, fastapi_app: FastAPI, mock_user_role + client: AsyncClient, fastapi_app: FastAPI, set_mock_user ) -> None: # Set mock user role for organization update. - mock_user_role([RoleEnum.GOVERNMENT]) + set_mock_user(fastapi_app, [RoleEnum.GOVERNMENT]) payload = { "name": "Test Organization", "operatingName": "Test Operating name", @@ -150,10 +149,10 @@ async def test_update_organization_success( @pytest.mark.anyio async def test_update_organization_failure( - client: AsyncClient, fastapi_app: FastAPI, mock_user_role + client: AsyncClient, fastapi_app: FastAPI, set_mock_user ) -> None: # Set mock user role for organization update - mock_user_role([RoleEnum.GOVERNMENT]) + set_mock_user(fastapi_app, [RoleEnum.GOVERNMENT]) payload = { "name": "Test Organizationa", "operatingName": "Test Operating name", @@ -333,22 +332,21 @@ async def create_organization( client: AsyncClient, fastapi_app: FastAPI, payload: dict, - #role: RoleEnum = RoleEnum.GOVERNMENT + # role: RoleEnum = RoleEnum.GOVERNMENT ) -> object: """Helper function to create an organization and return the response.""" - #mock_user_role([role]) + # set_mock_user([role]) url = fastapi_app.url_path_for("create_organization") response = await client.post(url, json=payload) return response async def update_organization( - client: AsyncClient, - fastapi_app: FastAPI, - organization_id: int, - payload: dict + client: AsyncClient, fastapi_app: FastAPI, organization_id: int, payload: dict ) -> object: """Helper function to update an organization and return the response.""" - url = fastapi_app.url_path_for("update_organization", organization_id=organization_id) + url = fastapi_app.url_path_for( + "update_organization", organization_id=organization_id + ) response = await client.put(url, json=payload) return response