Skip to content

Commit

Permalink
add convert to tfvar test
Browse files Browse the repository at this point in the history
  • Loading branch information
araghukas committed Jan 30, 2024
1 parent 68fbb5c commit c3c9267
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/covalent_tests/cloud_resource_manager/core_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,27 @@ def test_crm_get_resource_status(mocker, crm):
mock_terraform_error_validator.assert_called_once()


def test_crm_convert_to_tfvar(mocker, crm):
"""
Unit test for CloudResourceManager._convert_to_tfvar() method.
Test conversion outcomes.
"""
_values_map = {
# Convenient test case (not valid Terraform):
(1, False, None, "covalent321"): '[1, false, null, "covalent321"]',
# Usual test cases:
True: "true",
False: "false",
None: "null",
"covalent123": '"covalent123"', # must include quotes
16: "16",
}

for _value, _expected in _values_map.items():
assert crm._convert_to_tfvar(_value) == _expected


def test_no_git(crm, mocker):
"""
Test for exit with status 1 if `git` is not available.
Expand Down

0 comments on commit c3c9267

Please sign in to comment.