Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/integration/deploy/test_deploy_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,7 @@ def test_deploy_with_invalid_config(self, template_file, config_file):

deploy_process_execute = self.run_command(deploy_command_list)
self.assertEqual(deploy_process_execute.process.returncode, 1)
self.assertIn("Error reading configuration: Unexpected character", str(deploy_process_execute.stderr))
self.assertIn("SamConfigFileReadException: Unexpected character", str(deploy_process_execute.stderr))

@parameterized.expand([("aws-serverless-function.yaml", "samconfig-tags-list.toml")])
def test_deploy_with_valid_config_tags_list(self, template_file, config_file):
Expand Down
28 changes: 22 additions & 6 deletions tests/unit/lib/samconfig/test_file_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,16 @@ class TestTomlFileManager(TestCase):
def test_read_toml(self):
config_dir = tempfile.gettempdir()
config_path = Path(config_dir, "samconfig.toml")
config_path.write_text("version=0.1\n[config_env.topic1.parameters]\nword='clarity'\n")
config_path.write_text(
"version=0.1\n[config_env.topic1.parameters]\nword='clarity'\nmultiword=['thing 1', 'thing 2']"
)
config_doc = TomlFileManager.read(config_path)
self.assertEqual(
config_doc,
{"version": 0.1, "config_env": {"topic1": {"parameters": {"word": "clarity"}}}},
{
"version": 0.1,
"config_env": {"topic1": {"parameters": {"word": "clarity", "multiword": ["thing 1", "thing 2"]}}},
},
)

def test_read_toml_invalid_toml(self):
Expand Down Expand Up @@ -111,13 +116,18 @@ class TestYamlFileManager(TestCase):
def test_read_yaml(self):
config_dir = tempfile.gettempdir()
config_path = Path(config_dir, "samconfig.yaml")
config_path.write_text("version: 0.1\nconfig_env:\n topic1:\n parameters:\n word: clarity\n")
config_path.write_text(
"version: 0.1\nconfig_env:\n topic1:\n parameters:\n word: clarity\n multiword: [thing 1, thing 2]"
)

config_doc = YamlFileManager.read(config_path)

self.assertEqual(
config_doc,
{"version": 0.1, "config_env": {"topic1": {"parameters": {"word": "clarity"}}}},
{
"version": 0.1,
"config_env": {"topic1": {"parameters": {"word": "clarity", "multiword": ["thing 1", "thing 2"]}}},
},
)

def test_read_yaml_invalid_yaml(self):
Expand Down Expand Up @@ -189,7 +199,10 @@ def test_read_json(self):
config_path = Path(config_dir, "samconfig.json")
config_path.write_text(
json.dumps(
{"version": 0.1, "config_env": {"topic1": {"parameters": {"word": "clarity"}}}},
{
"version": 0.1,
"config_env": {"topic1": {"parameters": {"word": "clarity", "multiword": ["thing 1", "thing 2"]}}},
},
indent=JsonFileManager.INDENT_SIZE,
)
)
Expand All @@ -198,7 +211,10 @@ def test_read_json(self):

self.assertEqual(
config_doc,
{"version": 0.1, "config_env": {"topic1": {"parameters": {"word": "clarity"}}}},
{
"version": 0.1,
"config_env": {"topic1": {"parameters": {"word": "clarity", "multiword": ["thing 1", "thing 2"]}}},
},
)

def test_read_json_invalid_json(self):
Expand Down