# Path: virtool/db/mongo.py
# async def check_mongo_version(db: AsyncIOMotorClient) -> str:
#     """
#     Check the MongoDB version.
# 
#     Log a critical error and exit if it is too old. Return it otherwise.
# 
#     :param db: the application database object
#     :return: the MongoDB version
#     """
#     mongo_version = await get_mongo_version(db)
# 
#     if VersionInfo.parse(mongo_version) < VersionInfo.parse(MINIMUM_MONGO_VERSION):
#         logger.critical(
#             f"Virtool requires MongoDB {MINIMUM_MONGO_VERSION}. Found {mongo_version}."
#         )
#         sys.exit(1)
# 
#     logger.info(f"Found MongoDB {mongo_version}")
# 
#     return mongo_version


import logging
import pytest
from virtool.db.mongo import check_mongo_version




@pytest.mark.parametrize("version", ["3.5.9", "3.6.0", "3.6.1"])
async def test_check_mongo_version(dbi, caplog, mocker, version):
    mocker.patch("virtool.db.mongo.get_mongo_version", return_value=version)


# Path: virtool/db/mongo.py
# async def check_mongo_version(db: AsyncIOMotorClient) -> str:
#     """
#     Check the MongoDB version.
# 
#     Log a critical error and exit if it is too old. Return it otherwise.
# 
#     :param db: the application database object
#     :return: the MongoDB version
#     """
#     mongo_version = await get_mongo_version(db)
# 
#     if VersionInfo.parse(mongo_version) < VersionInfo.parse(MINIMUM_MONGO_VERSION):
#         logger.critical(
#             f"Virtool requires MongoDB {MINIMUM_MONGO_VERSION}. Found {mongo_version}."
#         )
#         sys.exit(1)
# 
#     logger.info(f"Found MongoDB {mongo_version}")
# 
#     return mongo_version


# Path: tests/db/test_mongo.py
import logging
import pytest
from virtool.db.mongo import check_mongo_version





@pytest.mark.parametrize("version", ["3.5.9", "3.6.0", "3.6.1"])
async def test_check_mongo_version(dbi, caplog, mocker, version):
    mocker.patch("virtool.db.mongo.get_mongo_version", return_value=version)


    caplog.set_level(logging.INFO)