Fix tests

This commit is contained in:
aubustou 2020-10-20 00:24:33 +02:00
parent 47cec4d211
commit ffd9e1de2a

View file

@ -50,7 +50,7 @@ CMD_CASES = [
'', '',
1, 1,
False, False,
'command: terraform import -no-color aws_instance.foo i-abcd1234', 'Command: terraform import -no-color aws_instance.foo i-abcd1234',
'' ''
], ],
# try import aws instance with raise_on_error # try import aws instance with raise_on_error
@ -59,7 +59,7 @@ CMD_CASES = [
'', '',
1, 1,
True, True,
'command: terraform import -no-color aws_instance.foo i-abcd1234', 'Command: terraform import -no-color aws_instance.foo i-abcd1234',
'' ''
], ],
# test with space and special character in file path # test with space and special character in file path
@ -77,7 +77,7 @@ CMD_CASES = [
'', '',
0, 0,
False, False,
'command: terraform workspace show -no-color', 'Command: terraform workspace show -no-color',
'' ''
], ],
] ]
@ -362,7 +362,7 @@ class TestTerraform(object):
def test_import(self, string_logger): def test_import(self, string_logger):
tf = Terraform(working_dir=current_path) tf = Terraform(working_dir=current_path)
tf.import_cmd('aws_instance.foo', 'i-abc1234', no_color=IsFlagged) tf.import_cmd('aws_instance.foo', 'i-abc1234', no_color=IsFlagged)
assert 'command: terraform import -no-color aws_instance.foo i-abc1234' in string_logger() assert 'Command: terraform import -no-color aws_instance.foo i-abc1234' in string_logger()
def test_create_workspace(self, workspace_setup_teardown): def test_create_workspace(self, workspace_setup_teardown):
workspace_name = 'test' workspace_name = 'test'
@ -384,7 +384,7 @@ class TestTerraform(object):
logs = string_logger() logs = string_logger()
logs = logs.replace('\n', '') logs = logs.replace('\n', '')
expected_log = 'command: terraform workspace new -no-color test {}'.format(current_path) expected_log = 'Command: terraform workspace new -no-color test {}'.format(current_path)
assert expected_log in logs assert expected_log in logs
def test_set_workspace(self, workspace_setup_teardown): def test_set_workspace(self, workspace_setup_teardown):
@ -405,7 +405,7 @@ class TestTerraform(object):
logs = string_logger() logs = string_logger()
logs = logs.replace('\n', '') logs = logs.replace('\n', '')
expected_log = 'command: terraform workspace select -no-color test {}'.format(current_path) expected_log = 'Command: terraform workspace select -no-color test {}'.format(current_path)
assert expected_log in logs assert expected_log in logs
def test_show_workspace(self, workspace_setup_teardown): def test_show_workspace(self, workspace_setup_teardown):
@ -427,7 +427,7 @@ class TestTerraform(object):
logs = string_logger() logs = string_logger()
logs = logs.replace('\n', '') logs = logs.replace('\n', '')
expected_log = 'command: terraform workspace show -no-color' expected_log = 'Command: terraform workspace show -no-color'
assert expected_log in logs assert expected_log in logs
def test_delete_workspace(self, workspace_setup_teardown): def test_delete_workspace(self, workspace_setup_teardown):
@ -453,5 +453,5 @@ class TestTerraform(object):
logs = string_logger() logs = string_logger()
logs = logs.replace('\n', '') logs = logs.replace('\n', '')
expected_log = 'command: terraform workspace delete -force test {}'.format(current_path) expected_log = 'Command: terraform workspace delete -force test {}'.format(current_path)
assert expected_log in logs assert expected_log in logs