diff --git a/src/config.py b/src/config.py index 28a8b26..9fe30c9 100644 --- a/src/config.py +++ b/src/config.py @@ -185,6 +185,8 @@ def load_config_from_file( source_files=source_files, destination_file=dest_file, root_path=root_path ) - def build(self): + def build(self, save_to_local_file: bool = True): content = self.generate_new_dest_content() - self.write_content(content) + if save_to_local_file: + self.write_content(content) + return content diff --git a/tests/test_config.py b/tests/test_config.py index 95ce96d..7eb89b7 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -109,7 +109,7 @@ def test_configs(self): src = SourceFile(src_file_location, "$.AnotherKeyInTheFile", "$") dest = DestinationFile(dest_file_location) config = BuildConfig([src], dest, Path(__file__).parent.resolve()) - assert config.generate_new_dest_content() == { + assert config.build(save_to_local_file=False) == { "Hello": "There", "UhOh": "This", "OneIs": "Nested",