def test_returns_None_if_missing_image(self): images, _ = self.make_all_boot_images(None) self.patch_list_boot_images(images) self.assertIsNone(get_boot_image({ "osystem": factory.make_name("os"), "release": factory.make_name("release"), "arch": factory.make_name("arch"), "subarch": factory.make_name("subarch"), "purpose": factory.make_name("purpose"), }))
def test_returns_image_by_its_supported_subarches(self): subarch = factory.make_name("hwe") other_subarches = [factory.make_name("hwe") for _ in range(3)] subarches = ",".join(other_subarches + [subarch]) images, expected_image = self.make_all_boot_images( "commissioning", subarch="generic", subarches=subarches ) self.patch_list_boot_images(images) params = self.get_params_from_boot_image(expected_image) params["subarch"] = subarch self.assertEqual(expected_image, get_boot_image(params))
def test_returns_install_image_for_install(self): images, expected_image = self.make_all_boot_images("install") self.patch_list_boot_images(images) params = self.get_params_from_boot_image(expected_image) self.assertEqual(expected_image, get_boot_image(params))
def test_returns_commissioning_image_for_commissioning(self): images, expected_image = self.make_all_boot_images("commissioning") self.patch_list_boot_images(images) params = self.get_params_from_boot_image(expected_image) self.assertEqual(expected_image, get_boot_image(params))