Example #1
0
    def test_plan(self, mock_action, cfngin_fixtures, tmp_path):
        """Test plan."""
        mock_instance = self.configure_mock_action_instance(mock_action)
        copy_basic_fixtures(cfngin_fixtures, tmp_path)

        # support python < 3.6
        cfngin = CFNgin(ctx=self.get_context(), sys_path=str(tmp_path))
        cfngin.plan()

        mock_action.assert_called_once()
        mock_instance.execute.assert_called_once_with()
Example #2
0
    def test_plan(self, mock_action, cfngin_fixtures, tmp_path):
        """Test plan."""
        mock_instance = self.configure_mock_action_instance(mock_action)
        copy_basic_fixtures(cfngin_fixtures, tmp_path)

        # support python < 3.6
        cfngin = CFNgin(ctx=self.get_context(), sys_path=str(tmp_path))
        cfngin.plan()

        assert get_env_creds() == cfngin._aws_credential_backup, \
            'env vars should be reverted upon completion'
        mock_action.assert_called_once()
        mock_instance.execute.assert_called_once_with()
Example #3
0
    def test_plan(self, mock_action, cfngin_fixtures, tmp_path, patch_safehaven):
        """Test plan."""
        mock_instance = self.configure_mock_action_instance(mock_action)
        copy_basic_fixtures(cfngin_fixtures, tmp_path)

        context = self.get_context()
        cfngin = CFNgin(ctx=context, sys_path=str(tmp_path))
        cfngin.plan()

        mock_action.assert_called_once()
        mock_instance.execute.assert_called_once_with()
        patch_safehaven.assert_has_calls(
            [
                call(environ=context.env_vars),
                call.__enter__(),
                call(argv=["stacker", "diff", str(tmp_path / "basic.yml")]),
                call.__enter__(),
                call.__exit__(None, None, None),
                call.__exit__(None, None, None),
            ]
        )