# Path: virtool/analyses/files.py
# async def create_analysis_file(
#     pg: AsyncEngine, analysis_id: str, analysis_format: str, name: str, size: int = None
# ) -> Dict[str, any]:
#     """
#     Create a row in the `analysis_files` SQL table that represents an analysis result file.
# 
#     :param pg: PostgreSQL AsyncEngine object
#     :param analysis_id: ID that corresponds to a parent analysis
#     :param analysis_format: Format of the analysis result file
#     :param name: Name of the analysis result file
#     :param size: Size of the analysis result file
#     :return: A dictionary representation of the newly created row
#     """
#     async with AsyncSession(pg) as session:
#         analysis_file = AnalysisFile(
#             name=name, analysis=analysis_id, format=analysis_format, size=size
#         )
# 
#         session.add(analysis_file)
# 
#         await session.flush()
# 
#         analysis_file.name_on_disk = f"{analysis_file.id}-{analysis_file.name}"
# 
#         analysis_file = analysis_file.to_dict()
# 
#         await session.commit()
# 
#         return analysis_file
# 
# Path: virtool/fake/wrapper.py
# class FakerWrapper:
#     def __init__(self):
#         self.fake = Faker()
#         self.fake.seed_instance(0)
#         self.fake.add_provider(address)
#         self.fake.add_provider(misc)
#         self.fake.add_provider(lorem)
#         self.fake.add_provider(python)
#         self.fake.add_provider(date_time)
#         self.fake.add_provider(profile)
# 
#         self.country = self.fake.country
# 
#         self.text = self.fake.text
#         self.word = self.fake.word
#         self.words = self.fake.words
# 
#         self.integer = self.fake.pyint
#         self.list = self.fake.pylist
#         self.boolean = self.fake.pybool
#         self.profile = self.fake.profile
#         self.date_time = self.fake.date_time
#         self.random_element = self.fake.random_element
# 
#     def get_mongo_id(self) -> str:
#         """
#         Create a predictable, fake ID for MongoDB that imitates Virtool IDs.
# 
#         :return: a fake MongoDB ID
# 
#         """
#         return self.fake.password(length=8, special_chars=False)
# 
# Path: virtool/types.py



import logging
import shutil
import aiofiles
import virtool.indexes.db
import virtool.jobs.db
import virtool.subtractions.db
import yaml
from dataclasses import dataclass
from operator import itemgetter
from types import SimpleNamespace
from typing import List
from virtool.analyses.files import create_analysis_file
from virtool.example import example_path
from virtool.fake.wrapper import FakerWrapper
from virtool.hmm.fake import create_fake_hmms
from virtool.indexes.files import create_index_file
from virtool.jobs.utils import JobRights
from virtool.otus.fake import create_fake_otus
from virtool.references.db import create_document
from virtool.samples.fake import create_fake_sample
from virtool.settings.db import Settings
from virtool.subtractions.fake import (
    create_fake_fasta_upload,
    create_fake_finalized_subtraction,
)
from virtool.types import App
from virtool.utils import timestamp
                    "fasta" if index_file == "reference.fa.gz" else "bowtie2",
                    index_file,
                )

            base_url = self.app["config"].base_url

            document = await virtool.indexes.db.finalize(
                self.db, self.pg, base_url, ref_id, id_
            )

        return document

    async def hmms(self) -> List[dict]:
        return await create_fake_hmms(self.app)

    async def otus(self, ref_id: str) -> List[dict]:
        return await create_fake_otus(self.app, ref_id, self.user_id)

    async def job(self, workflow: str, args: dict, rights=JobRights()):
        return await virtool.jobs.db.create(
            db=self.db,
            workflow=workflow,
            job_args=args,
            user_id=self.user_id,
            job_id=self.job_id,
            rights=rights,
        )


async def load_test_case_from_yml(

# Path: virtool/analyses/files.py
# async def create_analysis_file(
#     pg: AsyncEngine, analysis_id: str, analysis_format: str, name: str, size: int = None
# ) -> Dict[str, any]:
#     """
#     Create a row in the `analysis_files` SQL table that represents an analysis result file.
# 
#     :param pg: PostgreSQL AsyncEngine object
#     :param analysis_id: ID that corresponds to a parent analysis
#     :param analysis_format: Format of the analysis result file
#     :param name: Name of the analysis result file
#     :param size: Size of the analysis result file
#     :return: A dictionary representation of the newly created row
#     """
#     async with AsyncSession(pg) as session:
#         analysis_file = AnalysisFile(
#             name=name, analysis=analysis_id, format=analysis_format, size=size
#         )
# 
#         session.add(analysis_file)
# 
#         await session.flush()
# 
#         analysis_file.name_on_disk = f"{analysis_file.id}-{analysis_file.name}"
# 
#         analysis_file = analysis_file.to_dict()
# 
#         await session.commit()
# 
#         return analysis_file
# 
# Path: virtool/fake/wrapper.py
# class FakerWrapper:
#     def __init__(self):
#         self.fake = Faker()
#         self.fake.seed_instance(0)
#         self.fake.add_provider(address)
#         self.fake.add_provider(misc)
#         self.fake.add_provider(lorem)
#         self.fake.add_provider(python)
#         self.fake.add_provider(date_time)
#         self.fake.add_provider(profile)
# 
#         self.country = self.fake.country
# 
#         self.text = self.fake.text
#         self.word = self.fake.word
#         self.words = self.fake.words
# 
#         self.integer = self.fake.pyint
#         self.list = self.fake.pylist
#         self.boolean = self.fake.pybool
#         self.profile = self.fake.profile
#         self.date_time = self.fake.date_time
#         self.random_element = self.fake.random_element
# 
#     def get_mongo_id(self) -> str:
#         """
#         Create a predictable, fake ID for MongoDB that imitates Virtool IDs.
# 
#         :return: a fake MongoDB ID
# 
#         """
#         return self.fake.password(length=8, special_chars=False)
# 
# Path: virtool/types.py



# Path: virtool/fake/factory.py
import logging
import shutil
import aiofiles
import virtool.indexes.db
import virtool.jobs.db
import virtool.subtractions.db
import yaml
from dataclasses import dataclass
from operator import itemgetter
from types import SimpleNamespace
from typing import List
from virtool.analyses.files import create_analysis_file
from virtool.example import example_path
from virtool.fake.wrapper import FakerWrapper
from virtool.hmm.fake import create_fake_hmms
from virtool.indexes.files import create_index_file
from virtool.jobs.utils import JobRights
from virtool.otus.fake import create_fake_otus
from virtool.references.db import create_document
from virtool.samples.fake import create_fake_sample
from virtool.settings.db import Settings
from virtool.subtractions.fake import (
    create_fake_fasta_upload,
    create_fake_finalized_subtraction,
)
from virtool.types import App
from virtool.utils import timestamp

                    "fasta" if index_file == "reference.fa.gz" else "bowtie2",
                    index_file,
                )

            base_url = self.app["config"].base_url

            document = await virtool.indexes.db.finalize(
                self.db, self.pg, base_url, ref_id, id_
            )

        return document

    async def hmms(self) -> List[dict]:
        return await create_fake_hmms(self.app)

    async def otus(self, ref_id: str) -> List[dict]:
        return await create_fake_otus(self.app, ref_id, self.user_id)

    async def job(self, workflow: str, args: dict, rights=JobRights()):
        return await virtool.jobs.db.create(
            db=self.db,
            workflow=workflow,
            job_args=args,
            user_id=self.user_id,
            job_id=self.job_id,
            rights=rights,
        )


async def load_test_case_from_yml(

    app: App, path: str, user_id: str