from dockervault.classification.engine import ClassificationEngine
from dockervault.classification.models import MountCandidate, Classification


def test_minecraft():
    engine = ClassificationEngine()

    c = MountCandidate(
        service_name="mc",
        image="itzg/minecraft-server",
        source="data",
        target="/data",
        mount_type="bind"
    )

    result = engine.classify(c)
    assert result.classification == Classification.CRITICAL


def test_database():
    engine = ClassificationEngine()

    c = MountCandidate(
        service_name="db",
        image="mysql",
        source="db",
        target="/var/lib/mysql",
        mount_type="bind"
    )

    result = engine.classify(c)
    assert result.classification == Classification.CRITICAL


def test_logs():
    engine = ClassificationEngine()

    c = MountCandidate(
        service_name="nginx",
        image="nginx",
        source="logs",
        target="/var/log/nginx",
        mount_type="bind"
    )

    result = engine.classify(c)
    assert result.classification == Classification.OPTIONAL
