Example #1
0
def test_device_parse():
    d1 = 'eth0    ethernet  connected  Default'
    assert Device.parse(d1) == \
        Device('eth0', 'ethernet', 'connected', 'Default')
    d2 = 'lo      loopback  unmanaged  --'
    assert Device.parse(d2) == \
        Device('lo', 'loopback', 'unmanaged', None)
Example #2
0
def test_device_parse_when_failed():
    with pytest.raises(ValueError) as e:
        Device.parse('invalid')
    assert str(e.value) == 'Parse failed [invalid]'