generated from john/python-template
37 lines
1.3 KiB
Python
37 lines
1.3 KiB
Python
import pytest
|
|
|
|
|
|
class TestServiceBase:
|
|
class TestInitialization:
|
|
def test_initializes_with_defaults(self):
|
|
"""Test initialization with default session factory and queue."""
|
|
|
|
def test_initializes_with_custom_session_factory(self):
|
|
"""Test initialization with a provided session factory."""
|
|
|
|
def test_initializes_with_custom_queue(self):
|
|
"""Test initialization with a provided queue."""
|
|
|
|
class TestSessionScope:
|
|
@pytest.mark.asyncio
|
|
async def test_uses_provided_session(self):
|
|
"""Test that session scope reuses a provided session."""
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_creates_new_session_when_none_provided(self):
|
|
"""Test that session scope creates a new session when none is provided."""
|
|
|
|
class TestContextManagerBehavior:
|
|
@pytest.mark.asyncio
|
|
async def test_yields_session(self):
|
|
"""Test that session scope yields a usable session object."""
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_multiple_operations(self):
|
|
"""Test multiple operations within a single session scope."""
|
|
|
|
class TestEdgeCases:
|
|
@pytest.mark.asyncio
|
|
async def test_handles_exception_propagation(self):
|
|
"""Test exception propagation behavior inside session scope."""
|