예제 #1
0
 def test_match_path_pxe_config_without_mac(self):
     method = PowerNVBootMethod()
     fake_mac = factory.make_mac_address("-")
     self.patch(powernv_module, "get_remote_mac").return_value = fake_mac
     config_path = b"ppc64el/pxelinux.cfg/default"
     params = method.match_path(None, config_path)
     expected = {"arch": "ppc64el", "mac": fake_mac}
     self.assertEqual(expected, params)
예제 #2
0
 def test_match_path_pxe_config_without_mac(self):
     method = PowerNVBootMethod()
     fake_mac = factory.make_mac_address("-")
     self.patch(powernv_module, 'get_remote_mac').return_value = fake_mac
     config_path = b'ppc64el/pxelinux.cfg/default'
     params = method.match_path(None, config_path)
     expected = {
         'arch': 'ppc64el',
         'mac': fake_mac,
     }
     self.assertEqual(expected, params)
예제 #3
0
 def test_match_path_pxe_prefix_request(self):
     method = PowerNVBootMethod()
     fake_mac = factory.make_mac_address("-")
     self.patch(powernv_module, "get_remote_mac").return_value = fake_mac
     file_path = b"ppc64el/file"
     params = method.match_path(None, file_path)
     expected = {
         "arch": "ppc64el",
         "mac": fake_mac,
         # The "ppc64el/" prefix has been removed from the path.
         "path": file_path.decode("utf-8")[8:],
     }
     self.assertEqual(expected, params)
예제 #4
0
 def test_match_path_pxe_config_with_mac(self):
     method = PowerNVBootMethod()
     config_path, args = get_example_path_and_components()
     params = method.match_path(None, config_path)
     expected = {"arch": "ppc64el", "mac": args["mac"].decode("ascii")}
     self.assertEqual(expected, params)