Пример #1
0
def test_status():
    s = DummySystemCommand(
        '''STATE      CONNECTIVITY  WIFI-HW  WIFI     WWAN-HW  WWAN
connected  full          enabled  enabled  enabled  enabled''')
    general = GeneralControl(s)
    r = general.status()
    assert r == General(NetworkManagerState.CONNECTED_GLOBAL,
                        NetworkConnectivity.FULL, True, True, True, True)
    assert s.passed_parameters == ['general', 'status']
Пример #2
0
def test_general():
    s = DummySystemCommand(
        '''STATE      CONNECTIVITY  WIFI-HW  WIFI     WWAN-HW  WWAN
connected  full          enabled  enabled  enabled  enabled''')
    general = GeneralControl(s)
    r = general()
    assert r == General('connected', 'full', 'enabled', 'enabled', 'enabled',
                        'enabled')
    assert s.passed_parameters == 'general'
Пример #3
0
def test_set_hostname():
    s = DummySystemCommand()
    general = GeneralControl(s)
    general.set_hostname('test')
    assert s.passed_parameters == ['general', 'hostname', 'test']
Пример #4
0
def test_get_hostname():
    s = DummySystemCommand('test\n')
    general = GeneralControl(s)
    assert general.get_hostname() == 'test'
    assert s.passed_parameters == ['general', 'hostname']