fixed output tests
This commit is contained in:
parent
412ea860f8
commit
3d2c7ae396
2 changed files with 6 additions and 4 deletions
|
@ -338,7 +338,7 @@ class Terraform:
|
||||||
return ret_code, out, err
|
return ret_code, out, err
|
||||||
|
|
||||||
def output(
|
def output(
|
||||||
self, *args, capture_output: bool = True, **kwargs
|
self, dir_or_plan: Optional[str] = None, *args, capture_output: bool = True, **kwargs
|
||||||
) -> Union[None, str, Dict[str, str], Dict[str, Dict[str, str]]]:
|
) -> Union[None, str, Dict[str, str], Dict[str, Dict[str, str]]]:
|
||||||
"""Refer https://www.terraform.io/docs/commands/output.html
|
"""Refer https://www.terraform.io/docs/commands/output.html
|
||||||
|
|
||||||
|
@ -366,8 +366,10 @@ class Terraform:
|
||||||
if capture_output is False:
|
if capture_output is False:
|
||||||
raise ValueError("capture_output is required for this method")
|
raise ValueError("capture_output is required for this method")
|
||||||
|
|
||||||
global_opts = self._generate_default_general_options(False)
|
global_opts = self._generate_default_general_options(dir_or_plan)
|
||||||
ret, out, _ = self.output_cmd(global_opts, *args, **kwargs)
|
ret, out, _ = self.cmd(global_opts, "output", *args, **kwargs)
|
||||||
|
|
||||||
|
# ret, out, _ = self.output_cmd(global_opts, *args, **kwargs)
|
||||||
|
|
||||||
if ret:
|
if ret:
|
||||||
return None
|
return None
|
||||||
|
|
|
@ -408,7 +408,7 @@ class TestTerraform:
|
||||||
tf.init("var_to_output")
|
tf.init("var_to_output")
|
||||||
tf.apply("var_to_output")
|
tf.apply("var_to_output")
|
||||||
params = tuple() if output_all else (required_output,)
|
params = tuple() if output_all else (required_output,)
|
||||||
result = tf.output(*params)
|
result = tf.output("var_to_output", *params)
|
||||||
if output_all:
|
if output_all:
|
||||||
assert result[required_output]["value"] == expected_value
|
assert result[required_output]["value"] == expected_value
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue