- Implement tests for database generator to ensure proper session handling. - Create tests for EXIF extraction and conversion functions. - Add tests for image-related endpoints, ensuring proper data retrieval and isolation between clients. - Develop tests for OCR functionality, including language detection and text extraction. - Introduce tests for the image processing pipeline, covering success and failure scenarios. - Validate rate limiting functionality and ensure independent counters for different clients. - Implement scraper tests to verify HTML content fetching and error handling. - Add unit tests for various services, including storage and filename generation. - Establish worker entry point for ARQ to handle background image processing tasks.
96 lines
6.9 KiB
Plaintext
96 lines
6.9 KiB
Plaintext
============================= test session starts =============================
|
|
platform win32 -- Python 3.14.3, pytest-9.0.1, pluggy-1.6.0 -- C:\Users\bruno\scoop\apps\python\current\python.exe
|
|
cachedir: .pytest_cache
|
|
rootdir: C:\dev\git\python\imago\imago
|
|
configfile: pytest.ini
|
|
plugins: anyio-4.12.0, asyncio-1.3.0, cov-7.0.0, mock-3.15.1, respx-0.22.0
|
|
asyncio: mode=Mode.AUTO, debug=False, asyncio_default_fixture_loop_scope=None, asyncio_default_test_loop_scope=function
|
|
collecting ... collected 29 items
|
|
|
|
tests/test_auth.py::test_no_auth_returns_401 PASSED [ 3%]
|
|
tests/test_auth.py::test_invalid_key_returns_401 PASSED [ 6%]
|
|
tests/test_auth.py::test_no_bearer_prefix_returns_401 PASSED [ 10%]
|
|
tests/test_auth.py::test_empty_bearer_returns_401 PASSED [ 13%]
|
|
tests/test_auth.py::test_valid_key_returns_200 PASSED [ 17%]
|
|
tests/test_auth.py::test_inactive_client_returns_401 PASSED [ 20%]
|
|
tests/test_auth.py::test_missing_scope_returns_403 PASSED [ 24%]
|
|
tests/test_auth.py::test_scope_images_read_allowed PASSED [ 27%]
|
|
tests/test_auth.py::test_key_rotation PASSED [ 31%]
|
|
tests/test_auth.py::test_create_client_returns_key_once PASSED [ 34%]
|
|
tests/test_auth.py::test_list_clients_admin_only PASSED [ 37%]
|
|
tests/test_auth.py::test_update_client PASSED [ 41%]
|
|
tests/test_auth.py::test_soft_delete_client PASSED [ 44%]
|
|
tests/test_isolation.py::test_client_a_image_invisible_to_client_b PASSED [ 48%]
|
|
tests/test_isolation.py::test_client_b_cannot_read_client_a_image PASSED [ 51%]
|
|
tests/test_isolation.py::test_client_b_cannot_delete_client_a_image PASSED [ 55%]
|
|
tests/test_isolation.py::test_listing_returns_only_own_images PASSED [ 58%]
|
|
tests/test_isolation.py::test_reprocess_other_client_image_returns_404 PASSED [ 62%]
|
|
tests/test_isolation.py::test_sub_endpoints_other_client_returns_404 PASSED [ 65%]
|
|
tests/test_rate_limit.py::test_rate_limit_headers_present PASSED [ 68%]
|
|
tests/test_rate_limit.py::test_rate_limit_per_client_independent PASSED [ 72%]
|
|
tests/test_rate_limit.py::test_rate_limiter_is_configured PASSED [ 75%]
|
|
tests/test_services.py::test_exif_missing_file PASSED [ 79%]
|
|
tests/test_services.py::test_exif_dms_to_decimal PASSED [ 82%]
|
|
tests/test_services.py::test_ocr_disabled PASSED [ 86%]
|
|
tests/test_services.py::test_ocr_language_detection PASSED [ 89%]
|
|
tests/test_services.py::test_generate_filename PASSED [ 93%]
|
|
tests/test_services.py::test_generate_filename_no_extension PASSED [ 96%]
|
|
tests/test_services.py::test_image_detail_schema PASSED [100%]
|
|
|
|
============================== warnings summary ===============================
|
|
..\..\..\..\..\Users\bruno\scoop\apps\python\current\Lib\site-packages\google\genai\types.py:32
|
|
C:\Users\bruno\scoop\apps\python\current\Lib\site-packages\google\genai\types.py:32: DeprecationWarning: '_UnionGenericAlias' is deprecated and slated for removal in Python 3.17
|
|
VersionedUnionType = Union[typing.types.UnionType, typing._UnionGenericAlias]
|
|
|
|
..\..\..\..\..\Users\bruno\scoop\apps\python\current\Lib\site-packages\slowapi\extension.py:717
|
|
..\..\..\..\..\Users\bruno\scoop\apps\python\current\Lib\site-packages\slowapi\extension.py:717
|
|
..\..\..\..\..\Users\bruno\scoop\apps\python\current\Lib\site-packages\slowapi\extension.py:717
|
|
..\..\..\..\..\Users\bruno\scoop\apps\python\current\Lib\site-packages\slowapi\extension.py:717
|
|
C:\Users\bruno\scoop\apps\python\current\Lib\site-packages\slowapi\extension.py:717: DeprecationWarning: 'asyncio.iscoroutinefunction' is deprecated and slated for removal in Python 3.16; use inspect.iscoroutinefunction() instead
|
|
if asyncio.iscoroutinefunction(func):
|
|
|
|
..\..\..\..\..\Users\bruno\scoop\apps\python\current\Lib\site-packages\fastapi\routing.py:233: 38 warnings
|
|
C:\Users\bruno\scoop\apps\python\current\Lib\site-packages\fastapi\routing.py:233: DeprecationWarning: 'asyncio.iscoroutinefunction' is deprecated and slated for removal in Python 3.16; use inspect.iscoroutinefunction() instead
|
|
is_coroutine = asyncio.iscoroutinefunction(dependant.call)
|
|
|
|
..\..\..\..\..\Users\bruno\scoop\apps\python\current\Lib\site-packages\starlette\_utils.py:40: 42 warnings
|
|
tests/test_auth.py: 9 warnings
|
|
tests/test_isolation.py: 15 warnings
|
|
tests/test_rate_limit.py: 3 warnings
|
|
C:\Users\bruno\scoop\apps\python\current\Lib\site-packages\starlette\_utils.py:40: DeprecationWarning: 'asyncio.iscoroutinefunction' is deprecated and slated for removal in Python 3.16; use inspect.iscoroutinefunction() instead
|
|
return asyncio.iscoroutinefunction(obj) or (callable(obj) and asyncio.iscoroutinefunction(obj.__call__))
|
|
|
|
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
|
|
=============================== tests coverage ================================
|
|
_______________ coverage: platform win32, python 3.14.3-final-0 _______________
|
|
|
|
Name Stmts Miss Cover Missing
|
|
------------------------------------------------------------
|
|
app\__init__.py 0 0 100%
|
|
app\config.py 66 4 94% 78-81
|
|
app\database.py 21 12 43% 30-38, 43-46
|
|
app\dependencies\__init__.py 2 0 100%
|
|
app\dependencies\auth.py 37 0 100%
|
|
app\main.py 39 14 64% 24-39, 112, 122-128
|
|
app\middleware\__init__.py 22 7 68% 31, 40-45, 50-55, 60, 65
|
|
app\middleware\rate_limit.py 2 2 0% 1-3
|
|
app\models\__init__.py 3 0 100%
|
|
app\models\client.py 25 1 96% 60
|
|
app\models\image.py 65 4 94% 87, 95-97
|
|
app\routers\__init__.py 4 0 100%
|
|
app\routers\ai.py 31 16 48% 38-65, 90-102
|
|
app\routers\auth.py 68 4 94% 109, 131, 162, 191
|
|
app\routers\images.py 95 23 76% 60, 126, 129, 132, 214, 240, 285, 310, 340-354, 379-387, 408-413
|
|
app\schemas\__init__.py 77 0 100%
|
|
app\schemas\auth.py 22 0 100%
|
|
app\services\__init__.py 2 0 100%
|
|
app\services\ai_vision.py 172 149 13% 23-25, 30-45, 49-56, 60-65, 75-100, 110-169, 179-186, 190-199, 224-265, 272-323, 328-368, 373-413
|
|
app\services\exif_service.py 109 86 21% 22-23, 28-36, 41-45, 77-169
|
|
app\services\ocr_service.py 51 31 39% 11-13, 31, 50-104
|
|
app\services\pipeline.py 94 84 11% 17-18, 32-154
|
|
app\services\scraper.py 31 26 16% 23-70
|
|
app\services\storage.py 58 10 83% 53, 63, 89, 113-117, 122-123
|
|
------------------------------------------------------------
|
|
TOTAL 1096 473 57%
|
|
====================== 29 passed, 112 warnings in 2.18s =======================
|