Add Postgres table adapter with TableRepositoryInterface.
PR Title Check / check-title (pull_request) Successful in 7s
Code Quality Pipeline / code-quality (pull_request) Failing after 19s
Test Python Package / unit-tests (pull_request) Successful in 47s
Test Python Package / integration-tests (pull_request) Successful in 44s
Test Python Package / coverage-report (pull_request) Successful in 11s
PR Title Check / check-title (pull_request) Successful in 7s
Code Quality Pipeline / code-quality (pull_request) Failing after 19s
Test Python Package / unit-tests (pull_request) Successful in 47s
Test Python Package / integration-tests (pull_request) Successful in 44s
Test Python Package / coverage-report (pull_request) Successful in 11s
Introduce PostgresAdapter for dict-based row CRUD via psycopg3, including config, lazy exports, unit/integration tests with testcontainers, and an example UserTableRepository. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
co-authored by
Cursor
parent
f28d3c4844
commit
dc6f8a3e89
+14
-1
@@ -5,12 +5,14 @@ from __future__ import annotations
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
from minio import Minio
|
||||
import psycopg
|
||||
import pytest
|
||||
import redis
|
||||
|
||||
from python_repositories.adapters.minio_adapter import MinioAdapter
|
||||
from python_repositories.adapters.postgres_adapter import PostgresAdapter
|
||||
from python_repositories.adapters.redis_adapter import RedisAdapter
|
||||
from tests.conftest import TEST_MINIO_CONFIG, TEST_REDIS_CONFIG
|
||||
from tests.conftest import TEST_MINIO_CONFIG, TEST_POSTGRES_CONFIG, TEST_REDIS_CONFIG
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@@ -25,3 +27,14 @@ def minio_adapter() -> MinioAdapter:
|
||||
"""Provide a MinioAdapter with an injected mock client."""
|
||||
mock_client = MagicMock(spec=Minio)
|
||||
return MinioAdapter(config=TEST_MINIO_CONFIG, client=mock_client)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def postgres_adapter() -> PostgresAdapter:
|
||||
"""Provide a PostgresAdapter with an injected mock client."""
|
||||
mock_client = MagicMock(spec=psycopg.Connection)
|
||||
mock_cursor = MagicMock()
|
||||
mock_cursor.__enter__ = MagicMock(return_value=mock_cursor)
|
||||
mock_cursor.__exit__ = MagicMock(return_value=False)
|
||||
mock_client.cursor.return_value = mock_cursor
|
||||
return PostgresAdapter(config=TEST_POSTGRES_CONFIG, client=mock_client)
|
||||
|
||||
Reference in New Issue
Block a user