def test_parse_interfaces_with_filter(self): with mock.patch.object(ifconfig, '_parse_interface') as parse: parse.side_effect = lambda x: x retval = ifconfig._parse_interfaces(SAMPLE_OUTPUT, ['em']) self.assertEqual(len(retval), 3) for chunk in retval: self.assertTrue(chunk.startswith('em'))
def test_parse_interfaces(self): with mock.patch.object(ifconfig, '_parse_interface') as parse: parse.side_effect = lambda x: x retval = ifconfig._parse_interfaces(SAMPLE_OUTPUT) self.assertEqual(len(retval), 6)