-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[159] Improve apply arguments parsing logic
- Loading branch information
1 parent
d10afc8
commit abc6f65
Showing
4 changed files
with
86 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
35 changes: 35 additions & 0 deletions
35
tests/test_modules/terraform/test_handle_apply_arguments_parsing.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import pytest | ||
|
||
from leverage.modules.terraform import handle_apply_arguments_parsing | ||
|
||
|
||
class TestHandleApplyArgumentsParsing: | ||
@pytest.mark.parametrize( | ||
"input_args,expected_output", | ||
[ | ||
# Test case: Single '-key=value' | ||
(["-target=kubernetes_manifest.irfq"], ["-target=kubernetes_manifest.irfq"]), | ||
# Test case: '-key value' | ||
(["-target", "kubernetes_manifest.irfq"], ["-target", "kubernetes_manifest.irfq"]), | ||
# Test case: Multiple mixed arguments | ||
( | ||
["-target", "kubernetes_manifest.irfq", "-lock=false"], | ||
["-target", "kubernetes_manifest.irfq", "-lock=false"], | ||
), | ||
# Test case: '-var' arguments should be included as is | ||
(["-var", "name=value"], ["-var", "name=value"]), | ||
# Test case: Non-flag argument | ||
(["some_value"], ["some_value"]), | ||
# Test case: Mixed '-key=value' and '-key value' with '-var' | ||
( | ||
["-var", "name=value", "-target", "kubernetes_manifest.irfq", "-lock=false"], | ||
["-var", "name=value", "-target", "kubernetes_manifest.irfq", "-lock=false"], | ||
), | ||
# Test case: No arguments | ||
([], []), | ||
# Test case: '-key=value' format with '-var' | ||
(["-var", "name=value", "-lock=false"], ["-var", "name=value", "-lock=false"]), | ||
], | ||
) | ||
def test_handle_apply_arguments_parsing(self, input_args, expected_output): | ||
assert handle_apply_arguments_parsing(input_args) == expected_output |