示例#1
0
    def recipe_bump_version_test(self):
        """Test the Recipe's version bump function"""

        # Neither have a version
        recipe = recipes.Recipe("test-recipe", "A recipe used for testing",
                                None, None, None, None)
        new_version = recipe.bump_version(None)
        self.assertEqual(new_version, "0.0.1")

        # Original has a version, new does not
        recipe = recipes.Recipe("test-recipe", "A recipe used for testing",
                                None, None, None, None)
        new_version = recipe.bump_version("0.0.1")
        self.assertEqual(new_version, "0.0.2")

        # Original has no version, new does
        recipe = recipes.Recipe("test-recipe", "A recipe used for testing",
                                "0.1.0", None, None, None)
        new_version = recipe.bump_version(None)
        self.assertEqual(new_version, "0.1.0")

        # New and Original are the same
        recipe = recipes.Recipe("test-recipe", "A recipe used for testing",
                                "0.0.1", None, None, None)
        new_version = recipe.bump_version("0.0.1")
        self.assertEqual(new_version, "0.0.2")

        # New is different from Original
        recipe = recipes.Recipe("test-recipe", "A recipe used for testing",
                                "0.1.1", None, None, None)
        new_version = recipe.bump_version("0.0.1")
        self.assertEqual(new_version, "0.1.1")
示例#2
0
 def recipe_diff_test(self):
     """Test the recipe_diff function"""
     old_recipe = recipes.Recipe("test-recipe", "A recipe used for testing",
                                 "0.1.1", self.old_modules,
                                 self.old_packages, [])
     new_recipe = recipes.Recipe("test-recipe", "A recipe used for testing",
                                 "0.3.1", self.new_modules,
                                 self.new_packages, [])
     result = [{
         'new': {
             'Version': '0.3.1'
         },
         'old': {
             'Version': '0.1.1'
         }
     }, {
         'new': {
             'Module': {
                 'name': 'openssh',
                 'version': '2.8.1'
             }
         },
         'old': None
     }, {
         'new': None,
         'old': {
             'Module': {
                 'name': 'bash',
                 'version': '4.*'
             }
         }
     }, {
         'new': {
             'Module': {
                 'name': 'httpd',
                 'version': '3.8.*'
             }
         },
         'old': {
             'Module': {
                 'name': 'httpd',
                 'version': '3.7.*'
             }
         }
     }, {
         'new': {
             'Package': {
                 'name': 'git',
                 'version': '2.13.*'
             }
         },
         'old': None
     }]
     self.assertEqual(recipes.recipe_diff(old_recipe, new_recipe), result)
示例#3
0
 def test_02_commit_recipe(self):
     """Test committing a Recipe object"""
     recipe = recipes.Recipe("test-recipe", "A recipe used for testing",
                             None, None, None, None)
     oid = recipes.commit_recipe(self.repo, "master", recipe)
     self.assertNotEqual(oid, None)