# Path: aioconsul/client/util.py
# def prepare_node(data):
# def prepare_service(data):
# def prepare_check(data):


import pytest
from aioconsul.client import util


@pytest.mark.parametrize("input, expected", [
    (None, (None, {})),
    ("foo", ("foo", {})),
    ({"ID": "foo"}, ("foo", {})),
    ({"Node": "foo"}, ("foo", {})),
    ({
        "Node": {
            "Node": "foobar",
            "Address": "10.1.10.12",
            "TaggedAddresses": {
                "lan": "10.1.10.12",
                "wan": "10.1.10.12"
            }
        },
        "Service": {},
        "Checks": []
    }, ("foobar", {
        "Node": "foobar",
        "Address": "10.1.10.12",
        "TaggedAddresses": {
            "lan": "10.1.10.12",
            "wan": "10.1.10.12"
        }
    })),
])
def test_prepare_node(input, expected):

# Path: aioconsul/client/util.py
# def prepare_node(data):
# def prepare_service(data):
# def prepare_check(data):


# Path: tests/test_client_util.py
import pytest
from aioconsul.client import util



@pytest.mark.parametrize("input, expected", [
    (None, (None, {})),
    ("foo", ("foo", {})),
    ({"ID": "foo"}, ("foo", {})),
    ({"Node": "foo"}, ("foo", {})),
    ({
        "Node": {
            "Node": "foobar",
            "Address": "10.1.10.12",
            "TaggedAddresses": {
                "lan": "10.1.10.12",
                "wan": "10.1.10.12"
            }
        },
        "Service": {},
        "Checks": []
    }, ("foobar", {
        "Node": "foobar",
        "Address": "10.1.10.12",
        "TaggedAddresses": {
            "lan": "10.1.10.12",
            "wan": "10.1.10.12"
        }
    })),
])
def test_prepare_node(input, expected):

    assert util.prepare_node(input) == expected