Ejemplo n.º 1
0
    def test_parse_interfaces_count(self):
        """Should have 8 adapters"""

        nb_adapters = 8
        reader = InterfacesReader(INF_PATH)
        adapters = reader.parse_interfaces()
        self.assertEqual(len(adapters), nb_adapters)
Ejemplo n.º 2
0
 def updateAdapters(self):
     """ (re)read interfaces file and save adapters """
     reader = InterfacesReader(self._interfaces_path)
     self._adapters = reader.parse_interfaces()
     if not self._adapters:
         self._adapters = []
Ejemplo n.º 3
0
 def test_dnsnameservers_not_unknown(self):
     """All adapters should validate"""
     reader = InterfacesReader(INF_PATH)
     eth1 = next((x for x in reader.parse_interfaces() if x._ifAttributes['name'] == "eth1"), None)
     self.assertNotEqual(eth1, None)
     self.assertEqual(eth1._ifAttributes["dns-nameservers"], "8.8.8.8")
Ejemplo n.º 4
0
 def test_parse_interfaces(self):
     """All adapters should validate"""
     reader = InterfacesReader(INF_PATH)
     for adapter in reader.parse_interfaces():
         adapter.validateAll()