import pytest

from mininet.discovery.discovery import Device, User, Proxy


@pytest.fixture()
def device(addr_frontend) -> Device:
    device = Device()
    device.init_socket(addr_frontend)
    yield device
    device.destroy()

@pytest.fixture()
def user(addr_backend) -> User:
    user = User()
    user.init_socket(addr_backend)
    yield user
    user.destroy()
    user.device_list.clear()

@pytest.fixture()
def proxy(addr_pair) -> Proxy:
    proxy = Proxy()
    proxy.init_socket(addr_pair)
    yield proxy
    proxy.destroy()
