async def test_delete_model(validation_db: ConfigValidationEntityDb, config_models: List[ConfigValidation]) -> None: await validation_db.update_many(config_models) remaining = list(config_models) for _ in config_models: sub = remaining.pop() await validation_db.delete_value(sub) loaded = [sub async for sub in validation_db.all()] assert remaining.sort() == loaded.sort() assert len([sub async for sub in validation_db.all()]) == 0
async def test_update_model(validation_db: ConfigValidationEntityDb, config_models: List[ConfigValidation]) -> None: # multiple updates should work as expected await validation_db.update_many(config_models) await validation_db.update_many(config_models) await validation_db.update_many(config_models) loaded = [sub async for sub in validation_db.all()] assert config_models.sort() == loaded.sort()
async def test_load_model(validation_db: ConfigValidationEntityDb, config_models: List[ConfigValidation]) -> None: await validation_db.update_many(config_models) loaded = [sub async for sub in validation_db.all()] assert config_models.sort() == loaded.sort()
async def test_keys_model(validation_db: ConfigValidationEntityDb, config_models: List[ConfigValidation]) -> None: assert [key async for key in validation_db.keys()] == [] await validation_db.update_many(config_models) assert [key async for key in validation_db.keys()] == [a.id for a in config_models]