示例#1
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 = factory.make_mac_address("-").encode("ascii")
     match = re_config_file.match(b"ppc64el/pxelinux.cfg/01-%s" % mac)
     self.assertIsNotNone(match)
     self.assertEqual({"mac": mac}, match.groupdict())
示例#2
0
 def test_re_config_file_is_compatible_with_config_path_generator(self):
     # The regular expression for extracting components of the file path is
     # compatible with the PXE config path generator.
     for iteration in range(10):
         config_path, args = get_example_path_and_components()
         match = re_config_file.match(config_path)
         self.assertIsNotNone(match, config_path)
         self.assertEqual(args, match.groupdict())
示例#3
0
 def test_re_config_file_without_leading_slash(self):
     # The regular expression for extracting components of the file path
     # doesn't care if there's no leading forward slash; the TFTP server is
     # easy on this point, so it makes sense to be also.
     config_path, args = get_example_path_and_components()
     # Ensure there's no leading slash.
     config_path = config_path.lstrip(b"/")
     match = re_config_file.match(config_path)
     self.assertIsNotNone(match, config_path)
     self.assertEqual(args, match.groupdict())
示例#4
0
 def test_re_config_file_with_default(self):
     match = re_config_file.match(b"ppc64el/pxelinux.cfg/default")
     self.assertIsNotNone(match)
     self.assertEqual({"mac": None}, match.groupdict())
示例#5
0
 def test_re_config_file_does_not_match_file_not_in_pxelinux_cfg(self):
     self.assertIsNone(re_config_file.match(b"foo/01-aa-bb-cc-dd-ee-ff"))
示例#6
0
 def test_re_config_file_does_not_match_file_in_root(self):
     self.assertIsNone(re_config_file.match(b"01-aa-bb-cc-dd-ee-ff"))
示例#7
0
 def test_re_config_file_does_not_match_non_config_file(self):
     self.assertIsNone(re_config_file.match(b"ppc64el/pxelinux.cfg/kernel"))
示例#8
0
 def test_re_config_file_matches_pxelinux_cfg_with_leading_slash(self):
     mac = factory.make_mac_address("-").encode("ascii")
     match = re_config_file.match(b"/ppc64el/pxelinux.cfg/01-%s" % mac)
     self.assertIsNotNone(match)
     self.assertEqual({"mac": mac}, match.groupdict())