示例#1
0
    def recipe_freeze_test(self):
        """Test the recipe freeze() function"""
        # Use the repos-git.toml test, it only has http and php in it
        deps = [{
            "arch": "x86_64",
            "epoch": 0,
            "name": "httpd",
            "release": "1.el7",
            "version": "2.4.11"
        }, {
            "arch": "x86_64",
            "epoch": 0,
            "name": "php",
            "release": "1.el7",
            "version": "5.4.2"
        }]
        result = recipes.recipe_from_toml(self.input_toml["repos-git.toml"][0])
        self.assertEqual(result, self.input_toml["repos-git.toml"][1])

        # Freeze the recipe with our fake deps
        frozen = result.freeze(deps)
        self.assertTrue(frozen is not None)
        http_module = recipes.find_name("httpd", frozen["modules"])
        self.assertTrue(http_module is not None)
        self.assertEqual(http_module["version"], "2.4.11-1.el7.x86_64")

        php_module = recipes.find_name("php", frozen["modules"])
        self.assertTrue(php_module is not None)
        self.assertEqual(php_module["version"], "5.4.2-1.el7.x86_64")
示例#2
0
    def find_name_test(self):
        """Test the find_name function"""
        test_list = [{"name":"dog"}, {"name":"cat"}, {"name":"squirrel"}]

        self.assertEqual(recipes.find_name("dog", test_list), {"name":"dog"})
        self.assertEqual(recipes.find_name("cat", test_list), {"name":"cat"})
        self.assertEqual(recipes.find_name("squirrel", test_list), {"name":"squirrel"})

        self.assertIsNone(recipes.find_name("alien", test_list))