17 fail, 432 pass in 2m 1s
Annotations
Check warning on line 0 in lcfs.tests.compliance_report.test_compliance_report_views
github-actions / Backend Test Results
test_update_compliance_report_success (lcfs.tests.compliance_report.test_compliance_report_views) failed
backend/pytest-results.xml [took 0s]
Raw output
ValueError: Missing configuration: AUTH_URL, EMAIL_URL, CLIENT_ID, CLIENT_SECRET
client = <httpx.AsyncClient object at 0x7fe553c65900>
fastapi_app = <fastapi.applications.FastAPI object at 0x7fe553cfeb90>
compliance_report_base_schema = <function compliance_report_base_schema.<locals>._create_compliance_report_base_schema at 0x7fe558183400>
set_mock_user = <function set_mock_user.<locals>._set_mock_auth at 0x7fe553b87490>
@pytest.mark.anyio
async def test_update_compliance_report_success(
client: AsyncClient,
fastapi_app: FastAPI,
compliance_report_base_schema,
set_mock_user,
):
with patch(
"lcfs.web.api.compliance_report.views.ComplianceReportUpdateService.update_compliance_report"
) as mock_update_compliance_report, patch(
"lcfs.web.api.compliance_report.views.ComplianceReportValidation.validate_organization_access"
) as mock_validate_organization_access:
set_mock_user(fastapi_app, [RoleEnum.GOVERNMENT])
mock_compliance_report = compliance_report_base_schema()
mock_validate_organization_access.return_value = None
mock_update_compliance_report.return_value = mock_compliance_report
url = fastapi_app.url_path_for(
"update_compliance_report",
report_id=1,
)
payload = {"status": "Draft", "supplementalNote": "new supplemental note"}
> response = await client.put(url, json=payload)
lcfs/tests/compliance_report/test_compliance_report_views.py:524:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1885: in put
return await self.request(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1533: in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1620: in send
response = await self._send_handling_auth(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1648: in _send_handling_auth
response = await self._send_handling_redirects(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1685: in _send_handling_redirects
response = await self._send_single_request(request)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1722: in _send_single_request
response = await transport.handle_async_request(request)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_transports/asgi.py:162: in handle_async_request
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/applications.py:1054: in __call__
await super().__call__(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/applications.py:113: in __call__
await self.middleware_stack(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/errors.py:187: in __call__
raise exc
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/errors.py:165: in __call__
await self.app(scope, receive, _send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/authentication.py:48: in __call__
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/cors.py:85: in __call__
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/exceptions.py:62: in __call__
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:53: in wrapped_app
raise exc
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:42: in wrapped_app
await app(scope, receive, sender)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:715: in __call__
await self.middleware_stack(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:735: in app
await route.handle(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:288: in handle
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:76: in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:53: in wrapped_app
raise exc
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:42: in wrapped_app
await app(scope, receive, sender)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:73: in app
response = await f(request)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/routing.py:291: in app
solved_result = await solve_dependencies(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/dependencies/utils.py:615: in solve_dependencies
solved_result = await solve_dependencies(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/dependencies/utils.py:615: in solve_dependencies
solved_result = await solve_dependencies(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/dependencies/utils.py:640: in solve_dependencies
solved = await run_in_threadpool(call, **solved_result.values)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/concurrency.py:39: in run_in_threadpool
return await anyio.to_thread.run_sync(func, *args)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/anyio/to_thread.py:33: in run_sync
return await get_asynclib().run_sync_in_worker_thread(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/anyio/_backends/_asyncio.py:877: in run_sync_in_worker_thread
return await future
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/anyio/_backends/_asyncio.py:807: in run
result = context.run(func, *args)
lcfs/web/api/email/services.py:38: in __init__
self._validate_configuration()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <lcfs.web.api.email.services.CHESEmailService object at 0x7fe553cb8490>
def _validate_configuration(self):
"""
Validate the CHES configuration to ensure all necessary environment variables are set.
"""
missing = [key for key, value in self.config.items() if not value]
if missing:
> raise ValueError(f"Missing configuration: {', '.join(missing)}")
E ValueError: Missing configuration: AUTH_URL, EMAIL_URL, CLIENT_ID, CLIENT_SECRET
lcfs/web/api/email/services.py:53: ValueError
Check warning on line 0 in lcfs.tests.compliance_report.test_compliance_report_views
github-actions / Backend Test Results
test_update_compliance_report_forbidden (lcfs.tests.compliance_report.test_compliance_report_views) failed
backend/pytest-results.xml [took 0s]
Raw output
ValueError: Missing configuration: AUTH_URL, EMAIL_URL, CLIENT_ID, CLIENT_SECRET
client = <httpx.AsyncClient object at 0x7fe558c30730>
fastapi_app = <fastapi.applications.FastAPI object at 0x7fe558c31870>
set_mock_user = <function set_mock_user.<locals>._set_mock_auth at 0x7fe5589857e0>
@pytest.mark.anyio
async def test_update_compliance_report_forbidden(
client: AsyncClient,
fastapi_app: FastAPI,
set_mock_user,
):
set_mock_user(fastapi_app, [RoleEnum.ANALYST])
url = fastapi_app.url_path_for("update_compliance_report", report_id=1)
payload = {"status": "Draft", "supplementalNote": "new supplemental note"}
> response = await client.put(url, json=payload)
lcfs/tests/compliance_report/test_compliance_report_views.py:550:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1885: in put
return await self.request(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1533: in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1620: in send
response = await self._send_handling_auth(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1648: in _send_handling_auth
response = await self._send_handling_redirects(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1685: in _send_handling_redirects
response = await self._send_single_request(request)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1722: in _send_single_request
response = await transport.handle_async_request(request)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_transports/asgi.py:162: in handle_async_request
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/applications.py:1054: in __call__
await super().__call__(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/applications.py:113: in __call__
await self.middleware_stack(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/errors.py:187: in __call__
raise exc
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/errors.py:165: in __call__
await self.app(scope, receive, _send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/authentication.py:48: in __call__
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/cors.py:85: in __call__
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/exceptions.py:62: in __call__
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:53: in wrapped_app
raise exc
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:42: in wrapped_app
await app(scope, receive, sender)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:715: in __call__
await self.middleware_stack(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:735: in app
await route.handle(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:288: in handle
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:76: in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:53: in wrapped_app
raise exc
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:42: in wrapped_app
await app(scope, receive, sender)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:73: in app
response = await f(request)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/routing.py:291: in app
solved_result = await solve_dependencies(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/dependencies/utils.py:615: in solve_dependencies
solved_result = await solve_dependencies(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/dependencies/utils.py:615: in solve_dependencies
solved_result = await solve_dependencies(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/dependencies/utils.py:640: in solve_dependencies
solved = await run_in_threadpool(call, **solved_result.values)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/concurrency.py:39: in run_in_threadpool
return await anyio.to_thread.run_sync(func, *args)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/anyio/to_thread.py:33: in run_sync
return await get_asynclib().run_sync_in_worker_thread(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/anyio/_backends/_asyncio.py:877: in run_sync_in_worker_thread
return await future
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/anyio/_backends/_asyncio.py:807: in run
result = context.run(func, *args)
lcfs/web/api/email/services.py:38: in __init__
self._validate_configuration()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <lcfs.web.api.email.services.CHESEmailService object at 0x7fe558bfef20>
def _validate_configuration(self):
"""
Validate the CHES configuration to ensure all necessary environment variables are set.
"""
missing = [key for key, value in self.config.items() if not value]
if missing:
> raise ValueError(f"Missing configuration: {', '.join(missing)}")
E ValueError: Missing configuration: AUTH_URL, EMAIL_URL, CLIENT_ID, CLIENT_SECRET
lcfs/web/api/email/services.py:53: ValueError
Check warning on line 0 in lcfs.tests.compliance_report.test_compliance_report_views
github-actions / Backend Test Results
test_update_compliance_report_not_found (lcfs.tests.compliance_report.test_compliance_report_views) failed
backend/pytest-results.xml [took 0s]
Raw output
ValueError: Missing configuration: AUTH_URL, EMAIL_URL, CLIENT_ID, CLIENT_SECRET
client = <httpx.AsyncClient object at 0x7fe5526e74f0>
fastapi_app = <fastapi.applications.FastAPI object at 0x7fe5526e79d0>
set_mock_user = <function set_mock_user.<locals>._set_mock_auth at 0x7fe558a63130>
@pytest.mark.anyio
async def test_update_compliance_report_not_found(
client: AsyncClient,
fastapi_app: FastAPI,
set_mock_user,
):
with patch(
"lcfs.web.api.compliance_report.views.ComplianceReportUpdateService.update_compliance_report"
) as mock_update_compliance_report:
set_mock_user(fastapi_app, [RoleEnum.GOVERNMENT])
# Simulate that the report does not exist by raising an exception
mock_update_compliance_report.side_effect = DataNotFoundException(
"Compliance report not found"
)
url = fastapi_app.url_path_for(
"update_compliance_report", report_id=0
) # Non-existent ID
payload = {"status": "Draft", "supplementalNote": "new supplemental note"}
> response = await client.put(url, json=payload)
lcfs/tests/compliance_report/test_compliance_report_views.py:577:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1885: in put
return await self.request(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1533: in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1620: in send
response = await self._send_handling_auth(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1648: in _send_handling_auth
response = await self._send_handling_redirects(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1685: in _send_handling_redirects
response = await self._send_single_request(request)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1722: in _send_single_request
response = await transport.handle_async_request(request)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_transports/asgi.py:162: in handle_async_request
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/applications.py:1054: in __call__
await super().__call__(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/applications.py:113: in __call__
await self.middleware_stack(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/errors.py:187: in __call__
raise exc
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/errors.py:165: in __call__
await self.app(scope, receive, _send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/authentication.py:48: in __call__
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/cors.py:85: in __call__
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/exceptions.py:62: in __call__
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:53: in wrapped_app
raise exc
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:42: in wrapped_app
await app(scope, receive, sender)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:715: in __call__
await self.middleware_stack(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:735: in app
await route.handle(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:288: in handle
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:76: in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:53: in wrapped_app
raise exc
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:42: in wrapped_app
await app(scope, receive, sender)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:73: in app
response = await f(request)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/routing.py:291: in app
solved_result = await solve_dependencies(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/dependencies/utils.py:615: in solve_dependencies
solved_result = await solve_dependencies(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/dependencies/utils.py:615: in solve_dependencies
solved_result = await solve_dependencies(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/dependencies/utils.py:640: in solve_dependencies
solved = await run_in_threadpool(call, **solved_result.values)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/concurrency.py:39: in run_in_threadpool
return await anyio.to_thread.run_sync(func, *args)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/anyio/to_thread.py:33: in run_sync
return await get_asynclib().run_sync_in_worker_thread(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/anyio/_backends/_asyncio.py:877: in run_sync_in_worker_thread
return await future
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/anyio/_backends/_asyncio.py:807: in run
result = context.run(func, *args)
lcfs/web/api/email/services.py:38: in __init__
self._validate_configuration()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <lcfs.web.api.email.services.CHESEmailService object at 0x7fe5589665f0>
def _validate_configuration(self):
"""
Validate the CHES configuration to ensure all necessary environment variables are set.
"""
missing = [key for key, value in self.config.items() if not value]
if missing:
> raise ValueError(f"Missing configuration: {', '.join(missing)}")
E ValueError: Missing configuration: AUTH_URL, EMAIL_URL, CLIENT_ID, CLIENT_SECRET
lcfs/web/api/email/services.py:53: ValueError
Check warning on line 0 in lcfs.tests.compliance_report.test_compliance_report_views
github-actions / Backend Test Results
test_update_compliance_report_invalid_payload (lcfs.tests.compliance_report.test_compliance_report_views) failed
backend/pytest-results.xml [took 0s]
Raw output
ValueError: Missing configuration: AUTH_URL, EMAIL_URL, CLIENT_ID, CLIENT_SECRET
client = <httpx.AsyncClient object at 0x7fe558c326e0>
fastapi_app = <fastapi.applications.FastAPI object at 0x7fe5526e7970>
set_mock_user = <function set_mock_user.<locals>._set_mock_auth at 0x7fe558180700>
@pytest.mark.anyio
async def test_update_compliance_report_invalid_payload(
client: AsyncClient,
fastapi_app: FastAPI,
set_mock_user,
):
set_mock_user(fastapi_app, [RoleEnum.GOVERNMENT])
url = fastapi_app.url_path_for("update_compliance_report", report_id=1)
payload = {"invalidField": "invalidValue"} # Invalid payload structure
> response = await client.put(url, json=payload)
lcfs/tests/compliance_report/test_compliance_report_views.py:594:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1885: in put
return await self.request(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1533: in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1620: in send
response = await self._send_handling_auth(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1648: in _send_handling_auth
response = await self._send_handling_redirects(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1685: in _send_handling_redirects
response = await self._send_single_request(request)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1722: in _send_single_request
response = await transport.handle_async_request(request)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_transports/asgi.py:162: in handle_async_request
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/applications.py:1054: in __call__
await super().__call__(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/applications.py:113: in __call__
await self.middleware_stack(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/errors.py:187: in __call__
raise exc
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/errors.py:165: in __call__
await self.app(scope, receive, _send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/authentication.py:48: in __call__
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/cors.py:85: in __call__
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/exceptions.py:62: in __call__
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:53: in wrapped_app
raise exc
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:42: in wrapped_app
await app(scope, receive, sender)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:715: in __call__
await self.middleware_stack(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:735: in app
await route.handle(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:288: in handle
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:76: in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:53: in wrapped_app
raise exc
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:42: in wrapped_app
await app(scope, receive, sender)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:73: in app
response = await f(request)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/routing.py:291: in app
solved_result = await solve_dependencies(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/dependencies/utils.py:615: in solve_dependencies
solved_result = await solve_dependencies(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/dependencies/utils.py:615: in solve_dependencies
solved_result = await solve_dependencies(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/dependencies/utils.py:640: in solve_dependencies
solved = await run_in_threadpool(call, **solved_result.values)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/concurrency.py:39: in run_in_threadpool
return await anyio.to_thread.run_sync(func, *args)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/anyio/to_thread.py:33: in run_sync
return await get_asynclib().run_sync_in_worker_thread(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/anyio/_backends/_asyncio.py:877: in run_sync_in_worker_thread
return await future
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/anyio/_backends/_asyncio.py:807: in run
result = context.run(func, *args)
lcfs/web/api/email/services.py:38: in __init__
self._validate_configuration()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <lcfs.web.api.email.services.CHESEmailService object at 0x7fe5532528c0>
def _validate_configuration(self):
"""
Validate the CHES configuration to ensure all necessary environment variables are set.
"""
missing = [key for key, value in self.config.items() if not value]
if missing:
> raise ValueError(f"Missing configuration: {', '.join(missing)}")
E ValueError: Missing configuration: AUTH_URL, EMAIL_URL, CLIENT_ID, CLIENT_SECRET
lcfs/web/api/email/services.py:53: ValueError
Check warning on line 0 in lcfs.tests.compliance_report.test_compliance_report_views
github-actions / Backend Test Results
test_update_compliance_report_draft_success (lcfs.tests.compliance_report.test_compliance_report_views) failed
backend/pytest-results.xml [took 0s]
Raw output
ValueError: Missing configuration: AUTH_URL, EMAIL_URL, CLIENT_ID, CLIENT_SECRET
client = <httpx.AsyncClient object at 0x7fe5526f7dc0>
fastapi_app = <fastapi.applications.FastAPI object at 0x7fe558c31630>
compliance_report_base_schema = <function compliance_report_base_schema.<locals>._create_compliance_report_base_schema at 0x7fe553280e50>
set_mock_user = <function set_mock_user.<locals>._set_mock_auth at 0x7fe552fc9870>
@pytest.mark.anyio
async def test_update_compliance_report_draft_success(
client: AsyncClient,
fastapi_app: FastAPI,
compliance_report_base_schema,
set_mock_user,
):
with patch(
"lcfs.web.api.compliance_report.views.ComplianceReportUpdateService.update_compliance_report"
) as mock_update_compliance_report, patch(
"lcfs.web.api.compliance_report.views.ComplianceReportValidation.validate_organization_access"
) as mock_validate_organization_access:
set_mock_user(fastapi_app, [RoleEnum.GOVERNMENT])
mock_compliance_report = compliance_report_base_schema()
mock_validate_organization_access.return_value = None
mock_update_compliance_report.return_value = mock_compliance_report
url = fastapi_app.url_path_for(
"update_compliance_report",
report_id=1,
)
payload = {"status": "Draft", "supplementalNote": "Drafting a new report"}
> response = await client.put(url, json=payload)
lcfs/tests/compliance_report/test_compliance_report_views.py:624:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1885: in put
return await self.request(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1533: in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1620: in send
response = await self._send_handling_auth(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1648: in _send_handling_auth
response = await self._send_handling_redirects(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1685: in _send_handling_redirects
response = await self._send_single_request(request)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1722: in _send_single_request
response = await transport.handle_async_request(request)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_transports/asgi.py:162: in handle_async_request
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/applications.py:1054: in __call__
await super().__call__(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/applications.py:113: in __call__
await self.middleware_stack(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/errors.py:187: in __call__
raise exc
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/errors.py:165: in __call__
await self.app(scope, receive, _send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/authentication.py:48: in __call__
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/cors.py:85: in __call__
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/exceptions.py:62: in __call__
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:53: in wrapped_app
raise exc
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:42: in wrapped_app
await app(scope, receive, sender)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:715: in __call__
await self.middleware_stack(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:735: in app
await route.handle(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:288: in handle
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:76: in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:53: in wrapped_app
raise exc
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:42: in wrapped_app
await app(scope, receive, sender)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:73: in app
response = await f(request)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/routing.py:291: in app
solved_result = await solve_dependencies(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/dependencies/utils.py:615: in solve_dependencies
solved_result = await solve_dependencies(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/dependencies/utils.py:615: in solve_dependencies
solved_result = await solve_dependencies(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/dependencies/utils.py:640: in solve_dependencies
solved = await run_in_threadpool(call, **solved_result.values)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/concurrency.py:39: in run_in_threadpool
return await anyio.to_thread.run_sync(func, *args)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/anyio/to_thread.py:33: in run_sync
return await get_asynclib().run_sync_in_worker_thread(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/anyio/_backends/_asyncio.py:877: in run_sync_in_worker_thread
return await future
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/anyio/_backends/_asyncio.py:807: in run
result = context.run(func, *args)
lcfs/web/api/email/services.py:38: in __init__
self._validate_configuration()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <lcfs.web.api.email.services.CHESEmailService object at 0x7fe558ae2050>
def _validate_configuration(self):
"""
Validate the CHES configuration to ensure all necessary environment variables are set.
"""
missing = [key for key, value in self.config.items() if not value]
if missing:
> raise ValueError(f"Missing configuration: {', '.join(missing)}")
E ValueError: Missing configuration: AUTH_URL, EMAIL_URL, CLIENT_ID, CLIENT_SECRET
lcfs/web/api/email/services.py:53: ValueError
Check warning on line 0 in lcfs.tests.compliance_report.test_compliance_report_views
github-actions / Backend Test Results
test_update_compliance_report_submitted_success (lcfs.tests.compliance_report.test_compliance_report_views) failed
backend/pytest-results.xml [took 0s]
Raw output
ValueError: Missing configuration: AUTH_URL, EMAIL_URL, CLIENT_ID, CLIENT_SECRET
client = <httpx.AsyncClient object at 0x7fe552ed53c0>
fastapi_app = <fastapi.applications.FastAPI object at 0x7fe5526f5540>
compliance_report_base_schema = <function compliance_report_base_schema.<locals>._create_compliance_report_base_schema at 0x7fe552e31d80>
set_mock_user = <function set_mock_user.<locals>._set_mock_auth at 0x7fe553281fc0>
@pytest.mark.anyio
async def test_update_compliance_report_submitted_success(
client: AsyncClient,
fastapi_app: FastAPI,
compliance_report_base_schema,
set_mock_user,
):
with patch(
"lcfs.web.api.compliance_report.views.ComplianceReportUpdateService.update_compliance_report"
) as mock_update_compliance_report, patch(
"lcfs.web.api.compliance_report.views.ComplianceReportValidation.validate_organization_access"
) as mock_validate_organization_access:
set_mock_user(fastapi_app, [RoleEnum.GOVERNMENT])
mock_compliance_report = compliance_report_base_schema()
mock_validate_organization_access.return_value = None
mock_update_compliance_report.return_value = mock_compliance_report
url = fastapi_app.url_path_for(
"update_compliance_report",
report_id=1,
)
payload = {"status": "Submitted", "supplementalNote": "Submitting the report"}
> response = await client.put(url, json=payload)
lcfs/tests/compliance_report/test_compliance_report_views.py:662:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1885: in put
return await self.request(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1533: in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1620: in send
response = await self._send_handling_auth(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1648: in _send_handling_auth
response = await self._send_handling_redirects(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1685: in _send_handling_redirects
response = await self._send_single_request(request)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1722: in _send_single_request
response = await transport.handle_async_request(request)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_transports/asgi.py:162: in handle_async_request
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/applications.py:1054: in __call__
await super().__call__(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/applications.py:113: in __call__
await self.middleware_stack(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/errors.py:187: in __call__
raise exc
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/errors.py:165: in __call__
await self.app(scope, receive, _send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/authentication.py:48: in __call__
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/cors.py:85: in __call__
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/exceptions.py:62: in __call__
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:53: in wrapped_app
raise exc
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:42: in wrapped_app
await app(scope, receive, sender)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:715: in __call__
await self.middleware_stack(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:735: in app
await route.handle(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:288: in handle
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:76: in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:53: in wrapped_app
raise exc
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:42: in wrapped_app
await app(scope, receive, sender)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:73: in app
response = await f(request)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/routing.py:291: in app
solved_result = await solve_dependencies(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/dependencies/utils.py:615: in solve_dependencies
solved_result = await solve_dependencies(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/dependencies/utils.py:615: in solve_dependencies
solved_result = await solve_dependencies(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/dependencies/utils.py:640: in solve_dependencies
solved = await run_in_threadpool(call, **solved_result.values)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/concurrency.py:39: in run_in_threadpool
return await anyio.to_thread.run_sync(func, *args)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/anyio/to_thread.py:33: in run_sync
return await get_asynclib().run_sync_in_worker_thread(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/anyio/_backends/_asyncio.py:877: in run_sync_in_worker_thread
return await future
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/anyio/_backends/_asyncio.py:807: in run
result = context.run(func, *args)
lcfs/web/api/email/services.py:38: in __init__
self._validate_configuration()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <lcfs.web.api.email.services.CHESEmailService object at 0x7fe55816b040>
def _validate_configuration(self):
"""
Validate the CHES configuration to ensure all necessary environment variables are set.
"""
missing = [key for key, value in self.config.items() if not value]
if missing:
> raise ValueError(f"Missing configuration: {', '.join(missing)}")
E ValueError: Missing configuration: AUTH_URL, EMAIL_URL, CLIENT_ID, CLIENT_SECRET
lcfs/web/api/email/services.py:53: ValueError
Check warning on line 0 in lcfs.tests.compliance_report.test_compliance_report_views
github-actions / Backend Test Results
test_update_compliance_report_recommended_by_analyst_success (lcfs.tests.compliance_report.test_compliance_report_views) failed
backend/pytest-results.xml [took 0s]
Raw output
ValueError: Missing configuration: AUTH_URL, EMAIL_URL, CLIENT_ID, CLIENT_SECRET
client = <httpx.AsyncClient object at 0x7fe55352f7c0>
fastapi_app = <fastapi.applications.FastAPI object at 0x7fe552ed5840>
compliance_report_base_schema = <function compliance_report_base_schema.<locals>._create_compliance_report_base_schema at 0x7fe558986290>
set_mock_user = <function set_mock_user.<locals>._set_mock_auth at 0x7fe552e32290>
@pytest.mark.anyio
async def test_update_compliance_report_recommended_by_analyst_success(
client: AsyncClient,
fastapi_app: FastAPI,
compliance_report_base_schema,
set_mock_user,
):
with patch(
"lcfs.web.api.compliance_report.views.ComplianceReportUpdateService.update_compliance_report"
) as mock_update_compliance_report, patch(
"lcfs.web.api.compliance_report.views.ComplianceReportValidation.validate_organization_access"
) as mock_validate_organization_access:
set_mock_user(fastapi_app, [RoleEnum.GOVERNMENT])
mock_compliance_report = compliance_report_base_schema()
mock_validate_organization_access.return_value = None
mock_update_compliance_report.return_value = mock_compliance_report
url = fastapi_app.url_path_for(
"update_compliance_report",
report_id=1,
)
payload = {
"status": "Recommended by analyst",
"supplementalNote": "Analyst recommendation",
}
> response = await client.put(url, json=payload)
lcfs/tests/compliance_report/test_compliance_report_views.py:703:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1885: in put
return await self.request(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1533: in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1620: in send
response = await self._send_handling_auth(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1648: in _send_handling_auth
response = await self._send_handling_redirects(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1685: in _send_handling_redirects
response = await self._send_single_request(request)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1722: in _send_single_request
response = await transport.handle_async_request(request)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_transports/asgi.py:162: in handle_async_request
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/applications.py:1054: in __call__
await super().__call__(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/applications.py:113: in __call__
await self.middleware_stack(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/errors.py:187: in __call__
raise exc
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/errors.py:165: in __call__
await self.app(scope, receive, _send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/authentication.py:48: in __call__
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/cors.py:85: in __call__
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/exceptions.py:62: in __call__
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:53: in wrapped_app
raise exc
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:42: in wrapped_app
await app(scope, receive, sender)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:715: in __call__
await self.middleware_stack(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:735: in app
await route.handle(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:288: in handle
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:76: in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:53: in wrapped_app
raise exc
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:42: in wrapped_app
await app(scope, receive, sender)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:73: in app
response = await f(request)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/routing.py:291: in app
solved_result = await solve_dependencies(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/dependencies/utils.py:615: in solve_dependencies
solved_result = await solve_dependencies(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/dependencies/utils.py:615: in solve_dependencies
solved_result = await solve_dependencies(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/dependencies/utils.py:640: in solve_dependencies
solved = await run_in_threadpool(call, **solved_result.values)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/concurrency.py:39: in run_in_threadpool
return await anyio.to_thread.run_sync(func, *args)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/anyio/to_thread.py:33: in run_sync
return await get_asynclib().run_sync_in_worker_thread(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/anyio/_backends/_asyncio.py:877: in run_sync_in_worker_thread
return await future
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/anyio/_backends/_asyncio.py:807: in run
result = context.run(func, *args)
lcfs/web/api/email/services.py:38: in __init__
self._validate_configuration()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <lcfs.web.api.email.services.CHESEmailService object at 0x7fe55849b1f0>
def _validate_configuration(self):
"""
Validate the CHES configuration to ensure all necessary environment variables are set.
"""
missing = [key for key, value in self.config.items() if not value]
if missing:
> raise ValueError(f"Missing configuration: {', '.join(missing)}")
E ValueError: Missing configuration: AUTH_URL, EMAIL_URL, CLIENT_ID, CLIENT_SECRET
lcfs/web/api/email/services.py:53: ValueError
Check warning on line 0 in lcfs.tests.compliance_report.test_compliance_report_views
github-actions / Backend Test Results
test_update_compliance_report_recommended_by_manager_success (lcfs.tests.compliance_report.test_compliance_report_views) failed
backend/pytest-results.xml [took 0s]
Raw output
ValueError: Missing configuration: AUTH_URL, EMAIL_URL, CLIENT_ID, CLIENT_SECRET
client = <httpx.AsyncClient object at 0x7fe552ed7dc0>
fastapi_app = <fastapi.applications.FastAPI object at 0x7fe552ed7b50>
compliance_report_base_schema = <function compliance_report_base_schema.<locals>._create_compliance_report_base_schema at 0x7fe553280670>
set_mock_user = <function set_mock_user.<locals>._set_mock_auth at 0x7fe552691a20>
@pytest.mark.anyio
async def test_update_compliance_report_recommended_by_manager_success(
client: AsyncClient,
fastapi_app: FastAPI,
compliance_report_base_schema,
set_mock_user,
):
with patch(
"lcfs.web.api.compliance_report.views.ComplianceReportUpdateService.update_compliance_report"
) as mock_update_compliance_report, patch(
"lcfs.web.api.compliance_report.views.ComplianceReportValidation.validate_organization_access"
) as mock_validate_organization_access:
set_mock_user(fastapi_app, [RoleEnum.GOVERNMENT])
mock_compliance_report = compliance_report_base_schema()
mock_validate_organization_access.return_value = None
mock_update_compliance_report.return_value = mock_compliance_report
url = fastapi_app.url_path_for(
"update_compliance_report",
report_id=1,
)
payload = {
"status": "Recommended by manager",
"supplementalNote": "Manager recommendation",
}
> response = await client.put(url, json=payload)
lcfs/tests/compliance_report/test_compliance_report_views.py:744:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1885: in put
return await self.request(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1533: in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1620: in send
response = await self._send_handling_auth(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1648: in _send_handling_auth
response = await self._send_handling_redirects(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1685: in _send_handling_redirects
response = await self._send_single_request(request)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1722: in _send_single_request
response = await transport.handle_async_request(request)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_transports/asgi.py:162: in handle_async_request
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/applications.py:1054: in __call__
await super().__call__(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/applications.py:113: in __call__
await self.middleware_stack(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/errors.py:187: in __call__
raise exc
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/errors.py:165: in __call__
await self.app(scope, receive, _send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/authentication.py:48: in __call__
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/cors.py:85: in __call__
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/exceptions.py:62: in __call__
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:53: in wrapped_app
raise exc
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:42: in wrapped_app
await app(scope, receive, sender)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:715: in __call__
await self.middleware_stack(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:735: in app
await route.handle(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:288: in handle
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:76: in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:53: in wrapped_app
raise exc
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:42: in wrapped_app
await app(scope, receive, sender)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:73: in app
response = await f(request)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/routing.py:291: in app
solved_result = await solve_dependencies(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/dependencies/utils.py:615: in solve_dependencies
solved_result = await solve_dependencies(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/dependencies/utils.py:615: in solve_dependencies
solved_result = await solve_dependencies(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/dependencies/utils.py:640: in solve_dependencies
solved = await run_in_threadpool(call, **solved_result.values)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/concurrency.py:39: in run_in_threadpool
return await anyio.to_thread.run_sync(func, *args)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/anyio/to_thread.py:33: in run_sync
return await get_asynclib().run_sync_in_worker_thread(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/anyio/_backends/_asyncio.py:877: in run_sync_in_worker_thread
return await future
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/anyio/_backends/_asyncio.py:807: in run
result = context.run(func, *args)
lcfs/web/api/email/services.py:38: in __init__
self._validate_configuration()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <lcfs.web.api.email.services.CHESEmailService object at 0x7fe553e4c1f0>
def _validate_configuration(self):
"""
Validate the CHES configuration to ensure all necessary environment variables are set.
"""
missing = [key for key, value in self.config.items() if not value]
if missing:
> raise ValueError(f"Missing configuration: {', '.join(missing)}")
E ValueError: Missing configuration: AUTH_URL, EMAIL_URL, CLIENT_ID, CLIENT_SECRET
lcfs/web/api/email/services.py:53: ValueError
Check warning on line 0 in lcfs.tests.compliance_report.test_compliance_report_views
github-actions / Backend Test Results
test_update_compliance_report_assessed_success (lcfs.tests.compliance_report.test_compliance_report_views) failed
backend/pytest-results.xml [took 0s]
Raw output
ValueError: Missing configuration: AUTH_URL, EMAIL_URL, CLIENT_ID, CLIENT_SECRET
client = <httpx.AsyncClient object at 0x7fe558c45a50>
fastapi_app = <fastapi.applications.FastAPI object at 0x7fe552ed7c70>
compliance_report_base_schema = <function compliance_report_base_schema.<locals>._create_compliance_report_base_schema at 0x7fe552690430>
set_mock_user = <function set_mock_user.<locals>._set_mock_auth at 0x7fe553281cf0>
@pytest.mark.anyio
async def test_update_compliance_report_assessed_success(
client: AsyncClient,
fastapi_app: FastAPI,
compliance_report_base_schema,
set_mock_user,
):
with patch(
"lcfs.web.api.compliance_report.views.ComplianceReportUpdateService.update_compliance_report"
) as mock_update_compliance_report, patch(
"lcfs.web.api.compliance_report.views.ComplianceReportValidation.validate_organization_access"
) as mock_validate_organization_access:
set_mock_user(fastapi_app, [RoleEnum.GOVERNMENT])
mock_compliance_report = compliance_report_base_schema()
mock_validate_organization_access.return_value = None
mock_update_compliance_report.return_value = mock_compliance_report
url = fastapi_app.url_path_for(
"update_compliance_report",
report_id=1,
)
payload = {"status": "Assessed", "supplementalNote": "Report has been assessed"}
> response = await client.put(url, json=payload)
lcfs/tests/compliance_report/test_compliance_report_views.py:782:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1885: in put
return await self.request(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1533: in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1620: in send
response = await self._send_handling_auth(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1648: in _send_handling_auth
response = await self._send_handling_redirects(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1685: in _send_handling_redirects
response = await self._send_single_request(request)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1722: in _send_single_request
response = await transport.handle_async_request(request)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_transports/asgi.py:162: in handle_async_request
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/applications.py:1054: in __call__
await super().__call__(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/applications.py:113: in __call__
await self.middleware_stack(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/errors.py:187: in __call__
raise exc
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/errors.py:165: in __call__
await self.app(scope, receive, _send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/authentication.py:48: in __call__
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/cors.py:85: in __call__
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/exceptions.py:62: in __call__
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:53: in wrapped_app
raise exc
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:42: in wrapped_app
await app(scope, receive, sender)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:715: in __call__
await self.middleware_stack(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:735: in app
await route.handle(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:288: in handle
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:76: in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:53: in wrapped_app
raise exc
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:42: in wrapped_app
await app(scope, receive, sender)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:73: in app
response = await f(request)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/routing.py:291: in app
solved_result = await solve_dependencies(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/dependencies/utils.py:615: in solve_dependencies
solved_result = await solve_dependencies(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/dependencies/utils.py:615: in solve_dependencies
solved_result = await solve_dependencies(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/dependencies/utils.py:640: in solve_dependencies
solved = await run_in_threadpool(call, **solved_result.values)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/concurrency.py:39: in run_in_threadpool
return await anyio.to_thread.run_sync(func, *args)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/anyio/to_thread.py:33: in run_sync
return await get_asynclib().run_sync_in_worker_thread(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/anyio/_backends/_asyncio.py:877: in run_sync_in_worker_thread
return await future
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/anyio/_backends/_asyncio.py:807: in run
result = context.run(func, *args)
lcfs/web/api/email/services.py:38: in __init__
self._validate_configuration()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <lcfs.web.api.email.services.CHESEmailService object at 0x7fe553d23c40>
def _validate_configuration(self):
"""
Validate the CHES configuration to ensure all necessary environment variables are set.
"""
missing = [key for key, value in self.config.items() if not value]
if missing:
> raise ValueError(f"Missing configuration: {', '.join(missing)}")
E ValueError: Missing configuration: AUTH_URL, EMAIL_URL, CLIENT_ID, CLIENT_SECRET
lcfs/web/api/email/services.py:53: ValueError
Check warning on line 0 in lcfs.tests.notification.test_notification_views
github-actions / Backend Test Results
test_mark_notification_as_read (lcfs.tests.notification.test_notification_views) failed
backend/pytest-results.xml [took 0s]
Raw output
ValueError: Missing configuration: AUTH_URL, EMAIL_URL, CLIENT_ID, CLIENT_SECRET
client = <httpx.AsyncClient object at 0x7fe5529eea10>
fastapi_app = <fastapi.applications.FastAPI object at 0x7fe55327b760>
set_mock_user = <function set_mock_user.<locals>._set_mock_auth at 0x7fe5539bf880>
@pytest.mark.anyio
async def test_mark_notification_as_read(client, fastapi_app, set_mock_user):
with patch(
"lcfs.web.api.notification.views.NotificationService.update_notification"
) as mock_update_notification:
# Set the mock response data to include all required fields in camelCase
mock_update_notification.return_value = {
"notificationMessageId": 1,
"isRead": True,
"message": "Mark as read test",
"originUserProfileId": 1,
"relatedUserProfileId": 1,
"notificationTypeId": 1,
}
set_mock_user(fastapi_app, [RoleEnum.GOVERNMENT])
url = fastapi_app.url_path_for("save_notification")
payload = {
"notification_message_id": 1,
"is_read": True,
"message": "Mark as read test",
"origin_user_profile_id": 1,
"related_user_profile_id": 1,
"notification_type_id": 1,
}
> response = await client.post(url, json=payload)
lcfs/tests/notification/test_notification_views.py:67:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1848: in post
return await self.request(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1533: in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1620: in send
response = await self._send_handling_auth(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1648: in _send_handling_auth
response = await self._send_handling_redirects(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1685: in _send_handling_redirects
response = await self._send_single_request(request)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1722: in _send_single_request
response = await transport.handle_async_request(request)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_transports/asgi.py:162: in handle_async_request
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/applications.py:1054: in __call__
await super().__call__(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/applications.py:113: in __call__
await self.middleware_stack(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/errors.py:187: in __call__
raise exc
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/errors.py:165: in __call__
await self.app(scope, receive, _send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/authentication.py:48: in __call__
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/cors.py:85: in __call__
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/exceptions.py:62: in __call__
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:53: in wrapped_app
raise exc
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:42: in wrapped_app
await app(scope, receive, sender)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:715: in __call__
await self.middleware_stack(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:735: in app
await route.handle(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:288: in handle
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:76: in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:53: in wrapped_app
raise exc
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:42: in wrapped_app
await app(scope, receive, sender)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:73: in app
response = await f(request)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/routing.py:291: in app
solved_result = await solve_dependencies(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/dependencies/utils.py:615: in solve_dependencies
solved_result = await solve_dependencies(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/dependencies/utils.py:640: in solve_dependencies
solved = await run_in_threadpool(call, **solved_result.values)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/concurrency.py:39: in run_in_threadpool
return await anyio.to_thread.run_sync(func, *args)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/anyio/to_thread.py:33: in run_sync
return await get_asynclib().run_sync_in_worker_thread(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/anyio/_backends/_asyncio.py:877: in run_sync_in_worker_thread
return await future
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/anyio/_backends/_asyncio.py:807: in run
result = context.run(func, *args)
lcfs/web/api/email/services.py:38: in __init__
self._validate_configuration()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <lcfs.web.api.email.services.CHESEmailService object at 0x7fe55359e920>
def _validate_configuration(self):
"""
Validate the CHES configuration to ensure all necessary environment variables are set.
"""
missing = [key for key, value in self.config.items() if not value]
if missing:
> raise ValueError(f"Missing configuration: {', '.join(missing)}")
E ValueError: Missing configuration: AUTH_URL, EMAIL_URL, CLIENT_ID, CLIENT_SECRET
lcfs/web/api/email/services.py:53: ValueError
Check warning on line 0 in lcfs.tests.notification.test_notification_views
github-actions / Backend Test Results
test_create_notification (lcfs.tests.notification.test_notification_views) failed
backend/pytest-results.xml [took 0s]
Raw output
ValueError: Missing configuration: AUTH_URL, EMAIL_URL, CLIENT_ID, CLIENT_SECRET
client = <httpx.AsyncClient object at 0x7fe553b2ada0>
fastapi_app = <fastapi.applications.FastAPI object at 0x7fe5529ecc10>
set_mock_user = <function set_mock_user.<locals>._set_mock_auth at 0x7fe55822ce50>
@pytest.mark.anyio
async def test_create_notification(client, fastapi_app, set_mock_user):
with patch(
"lcfs.web.api.notification.views.NotificationService.create_notification_message"
) as mock_create_notification:
notification_data = {
"message": "New notification",
"notification_type_id": 1,
"related_user_profile_id": 1,
"related_organization_id": 1,
}
mock_create_notification.return_value = notification_data
set_mock_user(fastapi_app, [RoleEnum.GOVERNMENT])
url = fastapi_app.url_path_for("save_notification")
> response = await client.post(url, json=notification_data)
lcfs/tests/notification/test_notification_views.py:102:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1848: in post
return await self.request(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1533: in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1620: in send
response = await self._send_handling_auth(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1648: in _send_handling_auth
response = await self._send_handling_redirects(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1685: in _send_handling_redirects
response = await self._send_single_request(request)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1722: in _send_single_request
response = await transport.handle_async_request(request)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_transports/asgi.py:162: in handle_async_request
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/applications.py:1054: in __call__
await super().__call__(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/applications.py:113: in __call__
await self.middleware_stack(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/errors.py:187: in __call__
raise exc
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/errors.py:165: in __call__
await self.app(scope, receive, _send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/authentication.py:48: in __call__
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/cors.py:85: in __call__
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/exceptions.py:62: in __call__
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:53: in wrapped_app
raise exc
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:42: in wrapped_app
await app(scope, receive, sender)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:715: in __call__
await self.middleware_stack(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:735: in app
await route.handle(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:288: in handle
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:76: in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:53: in wrapped_app
raise exc
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:42: in wrapped_app
await app(scope, receive, sender)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:73: in app
response = await f(request)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/routing.py:291: in app
solved_result = await solve_dependencies(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/dependencies/utils.py:615: in solve_dependencies
solved_result = await solve_dependencies(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/dependencies/utils.py:640: in solve_dependencies
solved = await run_in_threadpool(call, **solved_result.values)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/concurrency.py:39: in run_in_threadpool
return await anyio.to_thread.run_sync(func, *args)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/anyio/to_thread.py:33: in run_sync
return await get_asynclib().run_sync_in_worker_thread(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/anyio/_backends/_asyncio.py:877: in run_sync_in_worker_thread
return await future
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/anyio/_backends/_asyncio.py:807: in run
result = context.run(func, *args)
lcfs/web/api/email/services.py:38: in __init__
self._validate_configuration()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <lcfs.web.api.email.services.CHESEmailService object at 0x7fe5537c7370>
def _validate_configuration(self):
"""
Validate the CHES configuration to ensure all necessary environment variables are set.
"""
missing = [key for key, value in self.config.items() if not value]
if missing:
> raise ValueError(f"Missing configuration: {', '.join(missing)}")
E ValueError: Missing configuration: AUTH_URL, EMAIL_URL, CLIENT_ID, CLIENT_SECRET
lcfs/web/api/email/services.py:53: ValueError
Check warning on line 0 in lcfs.tests.notification.test_notification_views
github-actions / Backend Test Results
test_delete_notification (lcfs.tests.notification.test_notification_views) failed
backend/pytest-results.xml [took 0s]
Raw output
ValueError: Missing configuration: AUTH_URL, EMAIL_URL, CLIENT_ID, CLIENT_SECRET
client = <httpx.AsyncClient object at 0x7fe55353b6a0>
fastapi_app = <fastapi.applications.FastAPI object at 0x7fe553b28a30>
set_mock_user = <function set_mock_user.<locals>._set_mock_auth at 0x7fe553b87d90>
@pytest.mark.anyio
async def test_delete_notification(client, fastapi_app, set_mock_user):
with patch(
"lcfs.web.api.notification.views.NotificationService.delete_notification_message",
return_value=None,
) as mock_delete_notification:
set_mock_user(fastapi_app, [RoleEnum.GOVERNMENT])
mock_delete_notification.return_value = {
"message": "Notification Message deleted successfully"
}
url = fastapi_app.url_path_for("save_notification") # No notification_id here
> response = await client.post(
url, json={"notification_message_id": 1, "deleted": True}
)
lcfs/tests/notification/test_notification_views.py:123:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1848: in post
return await self.request(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1533: in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1620: in send
response = await self._send_handling_auth(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1648: in _send_handling_auth
response = await self._send_handling_redirects(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1685: in _send_handling_redirects
response = await self._send_single_request(request)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1722: in _send_single_request
response = await transport.handle_async_request(request)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_transports/asgi.py:162: in handle_async_request
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/applications.py:1054: in __call__
await super().__call__(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/applications.py:113: in __call__
await self.middleware_stack(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/errors.py:187: in __call__
raise exc
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/errors.py:165: in __call__
await self.app(scope, receive, _send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/authentication.py:48: in __call__
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/cors.py:85: in __call__
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/exceptions.py:62: in __call__
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:53: in wrapped_app
raise exc
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:42: in wrapped_app
await app(scope, receive, sender)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:715: in __call__
await self.middleware_stack(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:735: in app
await route.handle(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:288: in handle
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:76: in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:53: in wrapped_app
raise exc
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:42: in wrapped_app
await app(scope, receive, sender)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:73: in app
response = await f(request)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/routing.py:291: in app
solved_result = await solve_dependencies(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/dependencies/utils.py:615: in solve_dependencies
solved_result = await solve_dependencies(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/dependencies/utils.py:640: in solve_dependencies
solved = await run_in_threadpool(call, **solved_result.values)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/concurrency.py:39: in run_in_threadpool
return await anyio.to_thread.run_sync(func, *args)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/anyio/to_thread.py:33: in run_sync
return await get_asynclib().run_sync_in_worker_thread(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/anyio/_backends/_asyncio.py:877: in run_sync_in_worker_thread
return await future
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/anyio/_backends/_asyncio.py:807: in run
result = context.run(func, *args)
lcfs/web/api/email/services.py:38: in __init__
self._validate_configuration()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <lcfs.web.api.email.services.CHESEmailService object at 0x7fe55378d270>
def _validate_configuration(self):
"""
Validate the CHES configuration to ensure all necessary environment variables are set.
"""
missing = [key for key, value in self.config.items() if not value]
if missing:
> raise ValueError(f"Missing configuration: {', '.join(missing)}")
E ValueError: Missing configuration: AUTH_URL, EMAIL_URL, CLIENT_ID, CLIENT_SECRET
lcfs/web/api/email/services.py:53: ValueError
Check warning on line 0 in lcfs.tests.notification.test_notification_views
github-actions / Backend Test Results
test_get_notifications_by_id (lcfs.tests.notification.test_notification_views) failed
backend/pytest-results.xml [took 0s]
Raw output
ValueError: Missing configuration: AUTH_URL, EMAIL_URL, CLIENT_ID, CLIENT_SECRET
client = <httpx.AsyncClient object at 0x7fe558c32200>
fastapi_app = <fastapi.applications.FastAPI object at 0x7fe5535399f0>
set_mock_user = <function set_mock_user.<locals>._set_mock_auth at 0x7fe5522657e0>
@pytest.mark.anyio
async def test_get_notifications_by_id(
client: AsyncClient,
fastapi_app: FastAPI,
set_mock_user,
):
with patch(
"lcfs.web.api.notification.views.NotificationService.get_notification_message_by_id"
) as mock_get_notifications:
mock_notification_data = mock_notification.model_copy()
mock_notification_data.related_user_profile_id = 1
mock_get_notifications.return_value = mock_notification_data
set_mock_user(
fastapi_app,
[RoleEnum.GOVERNMENT],
user_details={"user_profile_id": 1},
)
url = fastapi_app.url_path_for(
"get_notification_message_by_id", notification_id=1
)
print("Resolved URL:", url)
> response = await client.get(url)
lcfs/tests/notification/test_notification_views.py:156:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1757: in get
return await self.request(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1533: in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1620: in send
response = await self._send_handling_auth(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1648: in _send_handling_auth
response = await self._send_handling_redirects(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1685: in _send_handling_redirects
response = await self._send_single_request(request)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1722: in _send_single_request
response = await transport.handle_async_request(request)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_transports/asgi.py:162: in handle_async_request
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/applications.py:1054: in __call__
await super().__call__(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/applications.py:113: in __call__
await self.middleware_stack(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/errors.py:187: in __call__
raise exc
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/errors.py:165: in __call__
await self.app(scope, receive, _send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/authentication.py:48: in __call__
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/cors.py:85: in __call__
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/exceptions.py:62: in __call__
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:53: in wrapped_app
raise exc
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:42: in wrapped_app
await app(scope, receive, sender)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:715: in __call__
await self.middleware_stack(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:735: in app
await route.handle(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:288: in handle
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:76: in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:53: in wrapped_app
raise exc
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:42: in wrapped_app
await app(scope, receive, sender)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:73: in app
response = await f(request)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/routing.py:291: in app
solved_result = await solve_dependencies(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/dependencies/utils.py:615: in solve_dependencies
solved_result = await solve_dependencies(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/dependencies/utils.py:640: in solve_dependencies
solved = await run_in_threadpool(call, **solved_result.values)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/concurrency.py:39: in run_in_threadpool
return await anyio.to_thread.run_sync(func, *args)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/anyio/to_thread.py:33: in run_sync
return await get_asynclib().run_sync_in_worker_thread(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/anyio/_backends/_asyncio.py:877: in run_sync_in_worker_thread
return await future
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/anyio/_backends/_asyncio.py:807: in run
result = context.run(func, *args)
lcfs/web/api/email/services.py:38: in __init__
self._validate_configuration()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <lcfs.web.api.email.services.CHESEmailService object at 0x7fe5581fd300>
def _validate_configuration(self):
"""
Validate the CHES configuration to ensure all necessary environment variables are set.
"""
missing = [key for key, value in self.config.items() if not value]
if missing:
> raise ValueError(f"Missing configuration: {', '.join(missing)}")
E ValueError: Missing configuration: AUTH_URL, EMAIL_URL, CLIENT_ID, CLIENT_SECRET
lcfs/web/api/email/services.py:53: ValueError
Check warning on line 0 in lcfs.tests.notification.test_notification_views
github-actions / Backend Test Results
test_get_notification_channel_subscription_by_id (lcfs.tests.notification.test_notification_views) failed
backend/pytest-results.xml [took 0s]
Raw output
ValueError: Missing configuration: AUTH_URL, EMAIL_URL, CLIENT_ID, CLIENT_SECRET
client = <httpx.AsyncClient object at 0x7fe5531068c0>
fastapi_app = <fastapi.applications.FastAPI object at 0x7fe553104970>
set_mock_user = <function set_mock_user.<locals>._set_mock_auth at 0x7fe551f32ef0>
@pytest.mark.anyio
async def test_get_notification_channel_subscription_by_id(
client: AsyncClient,
fastapi_app: FastAPI,
set_mock_user,
):
with patch(
"lcfs.web.api.notification.views.NotificationService.get_notification_channel_subscription_by_id"
) as mock_get_subscription:
mock_subscription = SubscriptionSchema(
notification_channel_subscription_id=1,
user_profile_id=1, # Match mock user
notification_channel_name="EMAIL",
notification_type_name="BCEID__COMPLIANCE_REPORT__DIRECTOR_ASSESSMENT",
is_enabled=True,
)
mock_get_subscription.return_value = mock_subscription
set_mock_user(
fastapi_app,
[RoleEnum.GOVERNMENT],
user_details={"user_profile_id": 1},
)
url = fastapi_app.url_path_for(
"get_notification_channel_subscription_by_id",
notification_channel_subscription_id=1,
)
> response = await client.get(url)
lcfs/tests/notification/test_notification_views.py:192:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1757: in get
return await self.request(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1533: in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1620: in send
response = await self._send_handling_auth(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1648: in _send_handling_auth
response = await self._send_handling_redirects(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1685: in _send_handling_redirects
response = await self._send_single_request(request)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1722: in _send_single_request
response = await transport.handle_async_request(request)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_transports/asgi.py:162: in handle_async_request
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/applications.py:1054: in __call__
await super().__call__(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/applications.py:113: in __call__
await self.middleware_stack(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/errors.py:187: in __call__
raise exc
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/errors.py:165: in __call__
await self.app(scope, receive, _send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/authentication.py:48: in __call__
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/cors.py:85: in __call__
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/exceptions.py:62: in __call__
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:53: in wrapped_app
raise exc
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:42: in wrapped_app
await app(scope, receive, sender)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:715: in __call__
await self.middleware_stack(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:735: in app
await route.handle(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:288: in handle
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:76: in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:53: in wrapped_app
raise exc
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:42: in wrapped_app
await app(scope, receive, sender)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:73: in app
response = await f(request)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/routing.py:291: in app
solved_result = await solve_dependencies(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/dependencies/utils.py:615: in solve_dependencies
solved_result = await solve_dependencies(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/dependencies/utils.py:640: in solve_dependencies
solved = await run_in_threadpool(call, **solved_result.values)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/concurrency.py:39: in run_in_threadpool
return await anyio.to_thread.run_sync(func, *args)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/anyio/to_thread.py:33: in run_sync
return await get_asynclib().run_sync_in_worker_thread(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/anyio/_backends/_asyncio.py:877: in run_sync_in_worker_thread
return await future
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/anyio/_backends/_asyncio.py:807: in run
result = context.run(func, *args)
lcfs/web/api/email/services.py:38: in __init__
self._validate_configuration()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <lcfs.web.api.email.services.CHESEmailService object at 0x7fe553d00b80>
def _validate_configuration(self):
"""
Validate the CHES configuration to ensure all necessary environment variables are set.
"""
missing = [key for key, value in self.config.items() if not value]
if missing:
> raise ValueError(f"Missing configuration: {', '.join(missing)}")
E ValueError: Missing configuration: AUTH_URL, EMAIL_URL, CLIENT_ID, CLIENT_SECRET
lcfs/web/api/email/services.py:53: ValueError
Check warning on line 0 in lcfs.tests.notification.test_notification_views
github-actions / Backend Test Results
test_create_subscription (lcfs.tests.notification.test_notification_views) failed
backend/pytest-results.xml [took 0s]
Raw output
ValueError: Missing configuration: AUTH_URL, EMAIL_URL, CLIENT_ID, CLIENT_SECRET
client = <httpx.AsyncClient object at 0x7fe553bf4610>
fastapi_app = <fastapi.applications.FastAPI object at 0x7fe553104640>
set_mock_user = <function set_mock_user.<locals>._set_mock_auth at 0x7fe553b85090>
@pytest.mark.anyio
async def test_create_subscription(client, fastapi_app, set_mock_user):
with patch(
"lcfs.web.api.notification.views.NotificationService.create_notification_channel_subscription"
) as mock_create_subscription:
subscription_data = {
"is_enabled": True,
"notification_channel_id": 1,
"user_profile_id": 1,
"notification_type_id": 1,
}
mock_create_subscription.return_value = subscription_data
set_mock_user(fastapi_app, [RoleEnum.GOVERNMENT])
url = fastapi_app.url_path_for("save_subscription")
> response = await client.post(url, json=subscription_data)
lcfs/tests/notification/test_notification_views.py:219:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1848: in post
return await self.request(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1533: in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1620: in send
response = await self._send_handling_auth(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1648: in _send_handling_auth
response = await self._send_handling_redirects(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1685: in _send_handling_redirects
response = await self._send_single_request(request)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1722: in _send_single_request
response = await transport.handle_async_request(request)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_transports/asgi.py:162: in handle_async_request
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/applications.py:1054: in __call__
await super().__call__(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/applications.py:113: in __call__
await self.middleware_stack(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/errors.py:187: in __call__
raise exc
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/errors.py:165: in __call__
await self.app(scope, receive, _send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/authentication.py:48: in __call__
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/cors.py:85: in __call__
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/exceptions.py:62: in __call__
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:53: in wrapped_app
raise exc
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:42: in wrapped_app
await app(scope, receive, sender)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:715: in __call__
await self.middleware_stack(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:735: in app
await route.handle(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:288: in handle
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:76: in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:53: in wrapped_app
raise exc
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:42: in wrapped_app
await app(scope, receive, sender)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:73: in app
response = await f(request)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/routing.py:291: in app
solved_result = await solve_dependencies(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/dependencies/utils.py:615: in solve_dependencies
solved_result = await solve_dependencies(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/dependencies/utils.py:640: in solve_dependencies
solved = await run_in_threadpool(call, **solved_result.values)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/concurrency.py:39: in run_in_threadpool
return await anyio.to_thread.run_sync(func, *args)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/anyio/to_thread.py:33: in run_sync
return await get_asynclib().run_sync_in_worker_thread(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/anyio/_backends/_asyncio.py:877: in run_sync_in_worker_thread
return await future
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/anyio/_backends/_asyncio.py:807: in run
result = context.run(func, *args)
lcfs/web/api/email/services.py:38: in __init__
self._validate_configuration()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <lcfs.web.api.email.services.CHESEmailService object at 0x7fe5537a3010>
def _validate_configuration(self):
"""
Validate the CHES configuration to ensure all necessary environment variables are set.
"""
missing = [key for key, value in self.config.items() if not value]
if missing:
> raise ValueError(f"Missing configuration: {', '.join(missing)}")
E ValueError: Missing configuration: AUTH_URL, EMAIL_URL, CLIENT_ID, CLIENT_SECRET
lcfs/web/api/email/services.py:53: ValueError
Check warning on line 0 in lcfs.tests.notification.test_notification_views
github-actions / Backend Test Results
test_delete_subscription (lcfs.tests.notification.test_notification_views) failed
backend/pytest-results.xml [took 0s]
Raw output
ValueError: Missing configuration: AUTH_URL, EMAIL_URL, CLIENT_ID, CLIENT_SECRET
client = <httpx.AsyncClient object at 0x7fe552bffb50>
fastapi_app = <fastapi.applications.FastAPI object at 0x7fe553dd26e0>
set_mock_user = <function set_mock_user.<locals>._set_mock_auth at 0x7fe5533fca60>
@pytest.mark.anyio
async def test_delete_subscription(client, fastapi_app, set_mock_user):
with patch(
"lcfs.web.api.notification.views.NotificationService.delete_notification_channel_subscription",
return_value=None,
) as mock_delete_subscription:
set_mock_user(
fastapi_app,
[RoleEnum.GOVERNMENT],
user_details={"user_profile_id": 1},
)
url = fastapi_app.url_path_for("save_subscription")
subscription_data = {
"notification_channel_subscription_id": 1,
"deleted": True,
}
> response = await client.post(url, json=subscription_data)
lcfs/tests/notification/test_notification_views.py:246:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1848: in post
return await self.request(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1533: in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1620: in send
response = await self._send_handling_auth(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1648: in _send_handling_auth
response = await self._send_handling_redirects(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1685: in _send_handling_redirects
response = await self._send_single_request(request)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_client.py:1722: in _send_single_request
response = await transport.handle_async_request(request)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/httpx/_transports/asgi.py:162: in handle_async_request
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/applications.py:1054: in __call__
await super().__call__(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/applications.py:113: in __call__
await self.middleware_stack(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/errors.py:187: in __call__
raise exc
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/errors.py:165: in __call__
await self.app(scope, receive, _send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/authentication.py:48: in __call__
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/cors.py:85: in __call__
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/middleware/exceptions.py:62: in __call__
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:53: in wrapped_app
raise exc
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:42: in wrapped_app
await app(scope, receive, sender)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:715: in __call__
await self.middleware_stack(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:735: in app
await route.handle(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:288: in handle
await self.app(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:76: in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:53: in wrapped_app
raise exc
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/_exception_handler.py:42: in wrapped_app
await app(scope, receive, sender)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/routing.py:73: in app
response = await f(request)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/routing.py:291: in app
solved_result = await solve_dependencies(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/dependencies/utils.py:615: in solve_dependencies
solved_result = await solve_dependencies(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/fastapi/dependencies/utils.py:640: in solve_dependencies
solved = await run_in_threadpool(call, **solved_result.values)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/starlette/concurrency.py:39: in run_in_threadpool
return await anyio.to_thread.run_sync(func, *args)
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/anyio/to_thread.py:33: in run_sync
return await get_asynclib().run_sync_in_worker_thread(
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/anyio/_backends/_asyncio.py:877: in run_sync_in_worker_thread
return await future
/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/anyio/_backends/_asyncio.py:807: in run
result = context.run(func, *args)
lcfs/web/api/email/services.py:38: in __init__
self._validate_configuration()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <lcfs.web.api.email.services.CHESEmailService object at 0x7fe553a24af0>
def _validate_configuration(self):
"""
Validate the CHES configuration to ensure all necessary environment variables are set.
"""
missing = [key for key, value in self.config.items() if not value]
if missing:
> raise ValueError(f"Missing configuration: {', '.join(missing)}")
E ValueError: Missing configuration: AUTH_URL, EMAIL_URL, CLIENT_ID, CLIENT_SECRET
lcfs/web/api/email/services.py:53: ValueError
Check warning on line 0 in lcfs.tests.transfer.test_transfer_services
github-actions / Backend Test Results
test_create_transfer_success (lcfs.tests.transfer.test_transfer_services) failed
backend/pytest-results.xml [took 0s]
Raw output
lcfs.web.exception.exceptions.ServiceException
args = (<lcfs.web.api.transfer.services.TransferServices object at 0x7fe55869e7a0>, TransferCreateSchema(transfer_id=1, from_...t=None, gov_comment=None, transfer_category_id=None, current_status_id=None, current_status=None, recommendation=None))
kwargs = {}
logger = <BoundLoggerLazyProxy(logger=None, wrapper_class=None, processors=None, context_class=None, initial_values={}, logger_factory_args=('lcfs.web.api.transfer.services',))>
context = {'local_vars': {'self': '<Handle <TaskStepMethWrapper object at 0x7fe55869f6a0>()>'}, 'request': {'headers': None, 'method': None, 'url': None}, 'session_state': 'No session', 'user': {'id': None, 'roles': []}}
new_exception = ServiceException()
@wraps(func)
async def wrapper(*args, **kwargs):
logger = structlog.get_logger(func.__module__)
try:
> return await func(*args, **kwargs)
lcfs/web/core/decorators.py:215:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <lcfs.web.api.transfer.services.TransferServices object at 0x7fe55869e7a0>
transfer_data = TransferCreateSchema(transfer_id=1, from_organization_id=1, to_organization_id=2, from_transaction_id=None, to_transac...nt=None, gov_comment=None, transfer_category_id=None, current_status_id=None, current_status=None, recommendation=None)
@service_handler
async def create_transfer(
self, transfer_data: TransferCreateSchema
) -> TransferSchema:
"""
Handles creating a transfer, including creating a comment and any necessary
preprocessing. This method fetches organization instances and creates a new
transfer record along with a comment (if provided). If any part of the process
fails due to missing data or database issues, appropriate exceptions are raised
and handled by the @service_handler decorator.
"""
transfer = Transfer(**transfer_data.model_dump(exclude={"current_status"}))
current_status = await self.repo.get_transfer_status_by_name(
transfer_data.current_status
)
# TODO: Currenty by default category id is set to CATEGORY - A
# transfer.transfer_category_id = 1
transfer.current_status = current_status
notifications = TRANSFER_STATUS_NOTIFICATION_MAPPER.get(current_status.status)
if current_status.status == TransferStatusEnum.Sent:
await self.sign_and_send_from_supplier(transfer)
transfer = await self.repo.create_transfer(transfer)
# Add a new transfer history record if the status has changed
await self.repo.add_transfer_history(
transfer.transfer_id,
current_status.transfer_status_id,
self.request.user.user_profile_id,
)
> await self._perform_notificaiton_call(notifications, transfer)
E TypeError: TransferServices._perform_notificaiton_call() takes 2 positional arguments but 3 were given
lcfs/web/api/transfer/services.py:169: TypeError
The above exception was the direct cause of the following exception:
transfer_service = <lcfs.web.api.transfer.services.TransferServices object at 0x7fe55869e7a0>
mock_transfer_repo = <MagicMock spec='TransferRepository' id='140622927315632'>
@pytest.mark.anyio
async def test_create_transfer_success(transfer_service, mock_transfer_repo):
mock_transfer_repo.get_transfer_status_by_name.return_value = TransferStatus(
transfer_status_id=1, status="status"
)
mock_transfer_repo.add_transfer_history.return_value = True
transfer_id = 1
transfer = TransferCreateSchema(
transfer_id=transfer_id,
from_organization_id=1,
to_organization_id=2,
price_per_unit=5.75,
)
mock_transfer_repo.create_transfer.return_value = transfer
> result = await transfer_service.create_transfer(transfer)
lcfs/tests/transfer/test_transfer_services.py:78:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
lcfs/web/core/decorators.py:226: in wrapper
raise new_exception.with_traceback(e.__traceback__) from e
lcfs/web/core/decorators.py:215: in wrapper
return await func(*args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <lcfs.web.api.transfer.services.TransferServices object at 0x7fe55869e7a0>
transfer_data = TransferCreateSchema(transfer_id=1, from_organization_id=1, to_organization_id=2, from_transaction_id=None, to_transac...nt=None, gov_comment=None, transfer_category_id=None, current_status_id=None, current_status=None, recommendation=None)
@service_handler
async def create_transfer(
self, transfer_data: TransferCreateSchema
) -> TransferSchema:
"""
Handles creating a transfer, including creating a comment and any necessary
preprocessing. This method fetches organization instances and creates a new
transfer record along with a comment (if provided). If any part of the process
fails due to missing data or database issues, appropriate exceptions are raised
and handled by the @service_handler decorator.
"""
transfer = Transfer(**transfer_data.model_dump(exclude={"current_status"}))
current_status = await self.repo.get_transfer_status_by_name(
transfer_data.current_status
)
# TODO: Currenty by default category id is set to CATEGORY - A
# transfer.transfer_category_id = 1
transfer.current_status = current_status
notifications = TRANSFER_STATUS_NOTIFICATION_MAPPER.get(current_status.status)
if current_status.status == TransferStatusEnum.Sent:
await self.sign_and_send_from_supplier(transfer)
transfer = await self.repo.create_transfer(transfer)
# Add a new transfer history record if the status has changed
await self.repo.add_transfer_history(
transfer.transfer_id,
current_status.transfer_status_id,
self.request.user.user_profile_id,
)
> await self._perform_notificaiton_call(notifications, transfer)
E lcfs.web.exception.exceptions.ServiceException
lcfs/web/api/transfer/services.py:169: ServiceException