def test_construct_stack_with_valid_config( self, mock_Stack, mock_collect_s3_details ): mock_Stack.return_value = sentinel.stack mock_collect_s3_details.return_value = sentinel.s3_details config_reader = ConfigReader(self.test_sceptre_directory) stack = config_reader.construct_stack( "account/environment/region/vpc.yaml" ) mock_Stack.assert_called_with( name="account/environment/region/vpc", project_code="account_project_code", template_path=os.path.join( self.test_sceptre_directory, "path/to/template" ), region="region_region", iam_role="account_iam_role", parameters={"param1": "val1"}, sceptre_user_data={}, hooks={}, s3_details=sentinel.s3_details, dependencies=[], role_arn=None, protected=False, tags={}, external_name=None, notifications=None, on_failure=None ) assert stack == sentinel.stack
def get_stack_or_env(ctx, path): """ Parses the path to generate relevant Environment and Stack object. :param ctx: Cli context. :type ctx: click.Context :param path: Path to either stack config or environment folder. :type path: str """ stack = None env = None config_reader = ConfigReader(ctx.obj["awsscripter_dir"], ctx.obj["user_variables"]) if os.path.splitext(path)[1]: stack = config_reader.construct_stack(path) else: env = config_reader.construct_environment(path) return (stack, env)