Ejemplo n.º 1
0
 def test_re_config_file_matches_pxelinux_cfg_with_leading_slash(self):
     mac = b"aa-bb-cc-dd-ee-ff"
     match = re_config_file.match(b"/pxelinux.cfg/01-%s" % mac)
     self.assertIsNotNone(match)
     self.assertDictEqual(
         {"mac": mac, "hardware_uuid": None, "arch": None, "subarch": None},
         match.groupdict(),
     )
Ejemplo n.º 2
0
 def test_re_config_file_with_default(self):
     match = re_config_file.match(b'pxelinux.cfg/default')
     self.assertIsNotNone(match)
     self.assertEqual({
         'mac': None,
         'arch': None,
         'subarch': None
     }, match.groupdict())
Ejemplo n.º 3
0
 def test_re_config_file_with_default_arch(self):
     arch = factory.make_name('arch', sep='').encode("ascii")
     match = re_config_file.match(b'pxelinux.cfg/default.%s' % arch)
     self.assertIsNotNone(match)
     self.assertEqual({
         'mac': None,
         'arch': arch,
         'subarch': None
     }, match.groupdict())
Ejemplo n.º 4
0
 def test_re_config_file_matches_pxelinux_cfg_with_leading_slash(self):
     mac = b'aa-bb-cc-dd-ee-ff'
     match = re_config_file.match(b'/pxelinux.cfg/01-%s' % mac)
     self.assertIsNotNone(match)
     self.assertEqual({
         'mac': mac,
         'arch': None,
         'subarch': None
     }, match.groupdict())
Ejemplo n.º 5
0
 def test_re_config_file_matches_classic_pxelinux_cfg(self):
     # The default config path is simply "pxelinux.cfg" (without
     # leading slash).  The regex matches this.
     mac = b"aa-bb-cc-dd-ee-ff"
     match = re_config_file.match(b"pxelinux.cfg/01-%s" % mac)
     self.assertIsNotNone(match)
     self.assertDictEqual(
         {"mac": mac, "hardware_uuid": None, "arch": None, "subarch": None},
         match.groupdict(),
     )
Ejemplo n.º 6
0
 def test_re_config_file_matches_classic_pxelinux_cfg(self):
     # The default config path is simply "pxelinux.cfg" (without
     # leading slash).  The regex matches this.
     mac = b'aa-bb-cc-dd-ee-ff'
     match = re_config_file.match(b'pxelinux.cfg/01-%s' % mac)
     self.assertIsNotNone(match)
     self.assertEqual({
         'mac': mac,
         'arch': None,
         'subarch': None
     }, match.groupdict())
Ejemplo n.º 7
0
 def test_re_config_file_with_default(self):
     match = re_config_file.match(b"pxelinux.cfg/default")
     self.assertIsNotNone(match)
     self.assertDictEqual(
         {
             "mac": None,
             "hardware_uuid": None,
             "arch": None,
             "subarch": None,
         },
         match.groupdict(),
     )
Ejemplo n.º 8
0
 def test_re_config_file_matches_pxelinux_cfg_with_hardware_uuid(self):
     hardware_uuid = factory.make_UUID().encode()
     match = re_config_file.match(b"pxelinux.cfg/%s" % hardware_uuid)
     self.assertIsNotNone(match)
     self.assertDictEqual(
         {
             "mac": None,
             "hardware_uuid": hardware_uuid,
             "arch": None,
             "subarch": None,
         },
         match.groupdict(),
     )