コード例 #1
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 = self.get_example_path_and_components()
         match = re_config_file.match(config_path)
         self.assertIsNotNone(match, config_path)
         self.assertEqual(args, match.groupdict())
コード例 #2
0
 def test_re_config_file_with_default_arch(self):
     arch = factory.make_name("arch", sep="").encode("ascii")
     match = re_config_file.match(b"ipxe.cfg-default-%s" % arch)
     self.assertIsNotNone(match)
     self.assertDictEqual({
         "mac": None,
         "arch": arch,
         "subarch": None
     }, match.groupdict())
コード例 #3
0
 def test_re_config_file_matches_ipxe_cfg_with_leading_slash(self):
     mac = b"aa:bb:cc:dd:ee:ff"
     match = re_config_file.match(b"/ipxe.cfg-%s" % mac)
     self.assertIsNotNone(match)
     self.assertDictEqual({
         "mac": mac,
         "arch": None,
         "subarch": None
     }, match.groupdict())
コード例 #4
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 = self.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())
コード例 #5
0
 def test_re_config_file_with_default_arch(self):
     arch = factory.make_name('arch', sep='').encode("ascii")
     match = re_config_file.match(b'ipxe.cfg-default-%s' % arch)
     self.assertIsNotNone(match)
     self.assertDictEqual(
         {
             'mac': None,
             'arch': arch,
             'subarch': None,
         }, match.groupdict())
コード例 #6
0
 def test_re_config_file_matches_ipxe_cfg_with_leading_slash(self):
     mac = b'aa:bb:cc:dd:ee:ff'
     match = re_config_file.match(b'/ipxe.cfg-%s' % mac)
     self.assertIsNotNone(match)
     self.assertDictEqual(
         {
             'mac': mac,
             'arch': None,
             'subarch': None
         }, match.groupdict())
コード例 #7
0
 def test_re_config_file_matches_ipxe_cfg(self):
     # The default config path is simply "ipxe.cfg" (without
     # leading slash).  The regex matches this.
     mac = b"aa:bb:cc:dd:ee:ff"
     match = re_config_file.match(b"ipxe.cfg-%s" % mac)
     self.assertIsNotNone(match)
     self.assertDictEqual({
         "mac": mac,
         "arch": None,
         "subarch": None
     }, match.groupdict())
コード例 #8
0
 def test_re_config_file_matches_ipxe_cfg(self):
     # The default config path is simply "ipxe.cfg" (without
     # leading slash).  The regex matches this.
     mac = b'aa:bb:cc:dd:ee:ff'
     match = re_config_file.match(b'ipxe.cfg-%s' % mac)
     self.assertIsNotNone(match)
     self.assertDictEqual(
         {
             'mac': mac,
             'arch': None,
             'subarch': None,
         }, match.groupdict())
コード例 #9
0
 def test_re_config_file_does_not_match_file_in_root(self):
     self.assertIsNone(re_config_file.match(b"aa:bb:cc:dd:ee:ff"))
コード例 #10
0
 def test_re_config_file_does_not_match_non_config_file(self):
     self.assertIsNone(re_config_file.match(b"ipxe.cfg-kernel"))