mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-25 01:38:08 +00:00
26 lines
503 B
Python
26 lines
503 B
Python
|
from gns3server.modules.dynamips import Hub
|
||
|
from gns3server.modules.dynamips import NIO_Null
|
||
|
import pytest
|
||
|
|
||
|
|
||
|
@pytest.fixture
|
||
|
def hub(request, hypervisor):
|
||
|
|
||
|
hub = Hub(hypervisor, "hub")
|
||
|
request.addfinalizer(hub.delete)
|
||
|
return hub
|
||
|
|
||
|
|
||
|
def test_hub_exists(hub):
|
||
|
|
||
|
assert hub.list()
|
||
|
|
||
|
|
||
|
def test_add_remove_nio(hub):
|
||
|
|
||
|
nio = NIO_Null(hub.hypervisor)
|
||
|
hub.add_nio(nio, 0) # add NIO to port 0
|
||
|
assert hub.mapping[0] == nio
|
||
|
hub.remove_nio(0) # remove NIO from port 0
|
||
|
nio.delete()
|