minos.common.testing.database.clients

Classes

MockedDatabaseClient

For testing purposes

class MockedDatabaseClient[source]

Bases: DatabaseClient

For testing purposes

__init__(*args, **kwargs)[source]
property already_destroyed: bool

Already Destroy getter.

Returns

A boolean value.

property already_setup: bool

Already Setup getter.

Returns

A boolean value.

async destroy()

Destroy miscellaneous repository things.

Returns

This method does not return anything.

Return type

None

async execute(operation)

Execute an operation.

Parameters

operation (DatabaseOperation) – The operation to be executed.

Returns

This method does not return anything.

Return type

None

fetch_all()

Fetch all values with an asynchronous iterator.

Returns

This method does not return anything.

Return type

AsyncIterator[Any]

async fetch_one()

Fetch one value.

Returns

This method does not return anything.

Return type

Any

classmethod from_config(config=None, **kwargs)

Build a new instance from config.

Parameters
  • config (Optional[Union[Config, Path]]) – Config instance. If None is provided, default config is chosen.

  • kwargs – Additional named arguments.

Returns

A instance of the called class.

Return type

S

classmethod get_builder()

Get the builder class.

Returns

A Builder instance.

Return type

Builder[Ins]

classmethod get_factory(base)

Get an operation factory implementation for an operation factory interface.

Parameters

base (type[minos.common.database.operations.DatabaseOperationFactory]) – The operation factory interface.

Returns

The operation factory implementation.

Return type

DatabaseOperationFactory

async is_valid(**kwargs)

Check if the instance is valid.

Returns

True if it is valid or False otherwise.

Return type

bool

property lock: Optional[DatabaseLock]

Get the lock.

Returns

A DatabaseLock instance.

async reset(**kwargs)

Reset the current instance status.

Parameters

kwargs – Additional named parameters.

Returns

This method does not return anything.

Return type

None

classmethod set_builder(builder)

Set a builder class.

Parameters

builder (Union[Builder[Ins], type[minos.common.builders.Builder[~Ins]]]) – The builder class to be set.

Returns

This method does not return anything.

Return type

None

classmethod set_factory(base, impl)

Register an operation factory implementation for an operation factory interface.

Parameters
Returns

This method does not return anything.

Return type

None

async setup()

Setup miscellaneous repository things.

Returns

This method does not return anything.

Return type

None