Пример #1
0
def test_enable_wifi(mocker):
    from ideascube.serveradmin.wifi import enable_wifi

    NM = mocker.patch('ideascube.serveradmin.wifi.NetworkManager')
    NM.WirelessEnabled = False
    NM.WirelessHardwareEnabled = True

    enable_wifi()
    assert NM.WirelessEnabled is True
Пример #2
0
def test_enable_wifi(mocker):
    from ideascube.serveradmin.wifi import enable_wifi

    NM = mocker.patch('ideascube.serveradmin.wifi.NetworkManager')
    NM.WirelessEnabled = False
    NM.WirelessHardwareEnabled = True

    enable_wifi()
    assert NM.WirelessEnabled is True
Пример #3
0
def test_wifi_cannot_be_enabled(mocker):
    from ideascube.serveradmin.wifi import enable_wifi, WifiError

    class MockedNM(MagicMock):
        def __getattr__(self, name):
            raise AttributeError()

    mocker.patch('ideascube.serveradmin.wifi.NetworkManager', new=MockedNM())

    with pytest.raises(WifiError):
        enable_wifi()
Пример #4
0
def test_wifi_hardware_disabled(mocker):
    from ideascube.serveradmin.wifi import enable_wifi, WifiError

    NM = mocker.patch('ideascube.serveradmin.wifi.NetworkManager')
    NM.WirelessEnabled = False
    NM.WirelessHardwareEnabled = False

    with pytest.raises(WifiError):
        enable_wifi()

    assert NM.WirelessEnabled is False
Пример #5
0
def test_wifi_cannot_be_enabled(mocker):
    from ideascube.serveradmin.wifi import enable_wifi, WifiError

    class MockedNM(MagicMock):
        def __getattr__(self, name):
            raise AttributeError()

    mocker.patch('ideascube.serveradmin.wifi.NetworkManager', new=MockedNM())

    with pytest.raises(WifiError):
        enable_wifi()
Пример #6
0
def test_wifi_hardware_disabled(mocker):
    from ideascube.serveradmin.wifi import enable_wifi, WifiError

    NM = mocker.patch('ideascube.serveradmin.wifi.NetworkManager')
    NM.WirelessEnabled = False
    NM.WirelessHardwareEnabled = False

    with pytest.raises(WifiError):
        enable_wifi()

    assert NM.WirelessEnabled is False