"""Unit tests for the ephemeral one-host inventory helper (task 547).""" from steward.ansible.sources import host_inventory_content from steward.models.hosts import Host def test_with_address_sets_ansible_host(): inv = host_inventory_content(Host(name="web1", address="10.0.0.5")) assert inv == "web1 ansible_host=10.0.0.5\n" def test_without_address_falls_back_to_name(): inv = host_inventory_content(Host(name="web1", address="")) assert inv == "web1\n"