Esempio n. 1
0
 def test_heat_create_stack_environment_err(self):
     '''
     Test salt.modules.heat.create_stack method with environment set
     and there is an error reading the environment file
     '''
     patch_file = patch.dict(
         'salt.modules.heat.__salt__',
         {
             'file.get_managed':
             file_.get_managed,
             'file.manage_file':
             MagicMock(side_effect=[{
                 'result': True
             }, {
                 'result': False
             }]),
         },
     )
     patch_template = patch('salt.modules.heat._parse_template',
                            MagicMock(return_value=True))
     env_file = os.path.join(RUNTIME_VARS.BASE_FILES, 'templates',
                             'heat-env.yml')
     with patch_file, patch_template, self.patch_check:
         ret = heat.create_stack(name='mystack',
                                 profile='openstack1',
                                 environment=env_file,
                                 template_file=os.path.join(
                                     RUNTIME_VARS.BASE_FILES, 'templates',
                                     'heat-template.yml'))
     assert ret == {
         'result': False,
         'comment': 'Can not open environment: {0}, '.format(env_file)
     }
Esempio n. 2
0
 def test_heat_create_stack_environment_err(self):
     """
     Test salt.modules.heat.create_stack method with environment set
     and there is an error reading the environment file
     """
     patch_file = patch.dict(
         "salt.modules.heat.__salt__",
         {
             "file.get_managed": file_.get_managed,
             "file.manage_file": MagicMock(
                 side_effect=[{"result": True}, {"result": False}]
             ),
         },
     )
     patch_template = patch(
         "salt.modules.heat._parse_template", MagicMock(return_value=True)
     )
     env_file = os.path.join(RUNTIME_VARS.BASE_FILES, "templates", "heat-env.yml")
     with patch_file, patch_template, self.patch_check:
         ret = heat.create_stack(
             name="mystack",
             profile="openstack1",
             environment=env_file,
             template_file=os.path.join(
                 RUNTIME_VARS.BASE_FILES, "templates", "heat-template.yml"
             ),
         )
     assert ret == {
         "result": False,
         "comment": "Can not open environment: {0}, ".format(env_file),
     }
Esempio n. 3
0
    def test_heat_create_stack(self):
        '''
        Test salt.modules.heat.create_stack method
        '''
        patch_file = patch.dict(
            heat.__salt__,
            {
                'file.get_managed': file_.get_managed,
                'file.manage_file': file_.manage_file,
            },
        )

        with patch_file, self.patch_check:
            ret = heat.create_stack(name='mystack',
                                    profile='openstack1',
                                    template_file=os.path.join(
                                        RUNTIME_VARS.BASE_FILES, 'templates',
                                        'heat-template.yml'))
        assert ret == {'result': True, 'comment': "Created stack 'mystack'."}
Esempio n. 4
0
    def test_heat_create_stack(self):
        """
        Test salt.modules.heat.create_stack method
        """
        patch_file = patch.dict(
            heat.__salt__,
            {
                "file.get_managed": file_.get_managed,
                "file.manage_file": file_.manage_file,
            },
        )

        with patch_file, self.patch_check:
            ret = heat.create_stack(
                name="mystack",
                profile="openstack1",
                template_file=os.path.join(RUNTIME_VARS.BASE_FILES,
                                           "templates", "heat-template.yml"),
            )
        assert ret == {"result": True, "comment": "Created stack 'mystack'."}