Skip to content

Testing

cattle_grid.testing

cattle_grid.testing.fixtures

database() async

Fixture so that the database is initialized

Source code in cattle_grid/testing/fixtures.py
@pytest.fixture(autouse=True)
async def database():
    """Fixture so that the database is initialized"""
    async with with_database(db_uri="sqlite://:memory:", generate_schemas=True):
        yield

test_actor() async

Fixture to create an actor

Source code in cattle_grid/testing/fixtures.py
@pytest.fixture
async def test_actor():
    """Fixture to create an actor"""
    return await create_actor("http://localhost/ap")