def test_interface_get_by_id(dbsession): """Retrieve an interface by the id.""" interface = Interface("eth0") interface.save(dbsession) retrieved = Interface.get_by_id(interface.id) assert retrieved.id == interface.id
def populate_interfaces(tables, dbsession): """Populate interfaces into the database.""" interface = Interface("wlan0") interface.is_active = True interface.is_for_fm = True interface.is_external = True interface.state = "dhcp" interface.save(dbsession)
def test_create_wifi_with_interface(dbsession): """Create a WiFi instance with an interface.""" interface = Interface("eth0") interface.save(dbsession) wifi = Wifi() wifi.interface = interface wifi.save(dbsession) assert wifi.interface == interface assert wifi.interface_id == interface.id
def test_create_interface(dbsession): """Create a Interface instance.""" interface = Interface("eth0") interface.save(dbsession) assert interface.interface == "eth0" assert bool(interface.is_active) assert not bool(interface.is_for_fm) assert not bool(interface.is_external) assert interface.state is None assert interface.credentials == []
def test_add_wifi_network_with_interface(dbsession): """Test the add_wifi_netwrok function passing in an Interface.""" interface = Interface("wlan0") interface.state = "dhcp" interface.save(dbsession) wifi = add_wifi_network( wifi_name="TestWiFiName", wifi_password="******", interface=interface ) assert wifi.name == "TestWiFiName" assert wifi.password == "password" assert wifi.interface.id == interface.id assert wifi.mode == "dhcp" assert wifi in interface.credentials
def test_add_wifi_network(dbsession): """Test the add_wifi_network function.""" interface = Interface("wlan0") interface.state = "dhcp" interface.save(dbsession) wifi = add_wifi_network(wifi_name="TestWiFiName", wifi_password="******") dbsession.add(wifi) assert wifi.name == "TestWiFiName" assert wifi.password == "password" assert wifi.interface == interface assert wifi.mode == "dhcp" assert wifi in interface.credentials