"""Tests for the pure provisioning-input types."""

from __future__ import annotations

from mgf.vm.core.provisioning import ProvisioningInput, ProvisioningSpec
from mgf.vm.core.provisioning.spec import SimpleProvisioningInput


class TestProvisioningSpec:
    def test_defaults(self) -> None:
        prov = ProvisioningSpec()
        assert prov.backend == "none"
        assert prov.hostname is None
        assert prov.username is None
        assert prov.password is None
        assert prov.ssh_authorized_keys == []
        assert prov.packages == []
        assert prov.run_commands == []

    def test_independent_default_lists(self) -> None:
        a = ProvisioningSpec()
        b = ProvisioningSpec()
        a.packages.append("nginx")
        assert b.packages == []


class TestSimpleProvisioningInput:
    def test_default_provisioning(self) -> None:
        inp = SimpleProvisioningInput(name="vm")
        assert inp.name == "vm"
        assert isinstance(inp.provisioning, ProvisioningSpec)

    def test_satisfies_protocol(self) -> None:
        inp = SimpleProvisioningInput(name="vm")
        assert isinstance(inp, ProvisioningInput)
