import pytest

from mininet.control.control import Broker, Boss, Worker


@pytest.fixture()
def broker(addr_pair) -> Broker:
    broker = Broker()
    broker.init_socket(addr_pair)
    yield broker
    broker.destroy()

@pytest.fixture()
def boss(addr_frontend) -> Boss:
    boss = Boss()
    boss.init_socket(addr_frontend)
    boss.socket.connect("inproc://test")
    yield boss
    boss.destroy()

@pytest.fixture()
def worker(addr_backend) -> Worker:
    worker = Worker()
    worker.init_socket(addr_backend)
    worker.socket.bind("inproc://test")
    yield worker
    worker.destroy()
