MCPcopy Create free account
hub / github.com/beelit94/python-terraform / test_cmd

Method test_cmd

test/test_terraform.py:182–205  ·  view source on GitHub ↗
(
        self,
        method: Callable[..., str],
        expected_output: str,
        expected_ret_code: int,
        expected_exception: bool,
        expected_logs: str,
        caplog: LogCaptureFixture,
        folder: str,
    )

Source from the content-addressed store, hash-verified

180
181 @pytest.mark.parametrize(*CMD_CASES)
182 def test_cmd(
183 self,
184 method: Callable[..., str],
185 expected_output: str,
186 expected_ret_code: int,
187 expected_exception: bool,
188 expected_logs: str,
189 caplog: LogCaptureFixture,
190 folder: str,
191 ):
192 with caplog.at_level(logging.INFO):
193 tf = Terraform(working_dir=current_path)
194 tf.init(folder)
195 try:
196 ret, out, _ = method(tf)
197 assert not expected_exception
198 except TerraformCommandError as e:
199 assert expected_exception
200 ret = e.returncode
201 out = e.out
202
203 assert expected_output in out
204 assert expected_ret_code == ret
205 assert expected_logs in caplog.text
206
207 @pytest.mark.parametrize(
208 ("folder", "variables", "var_files", "expected_output", "options"),

Callers

nothing calls this directly

Calls 2

initMethod · 0.95
TerraformClass · 0.90

Tested by

no test coverage detected