add compatabilty for 0.10.0
This commit is contained in:
parent
3c700b9830
commit
4c65c1bbbe
1 changed files with 10 additions and 9 deletions
|
@ -29,20 +29,22 @@ STRING_CASES = [
|
|||
]
|
||||
|
||||
CMD_CASES = [
|
||||
['method', 'expected_output', 'expected_ret_code', 'expected_logs'],
|
||||
['method', 'expected_output', 'expected_ret_code', 'expected_logs', 'folder'],
|
||||
[
|
||||
[
|
||||
lambda x: x.cmd('plan', 'var_to_output', no_color=IsFlagged, var={'test_var': 'test'}) ,
|
||||
"doesn't need to do anything",
|
||||
0,
|
||||
''
|
||||
'',
|
||||
'var_to_output'
|
||||
],
|
||||
# try import aws instance
|
||||
[
|
||||
lambda x: x.cmd('import', 'aws_instance.foo', 'i-abcd1234', no_color=IsFlagged),
|
||||
'',
|
||||
1,
|
||||
'command: terraform import -no-color aws_instance.foo i-abcd1234'
|
||||
'command: terraform import -no-color aws_instance.foo i-abcd1234',
|
||||
''
|
||||
]
|
||||
]
|
||||
]
|
||||
|
@ -83,11 +85,6 @@ class TestTerraform(object):
|
|||
"""
|
||||
|
||||
def purge(dir, pattern):
|
||||
# for f in os.listdir(dir):
|
||||
# # if re.search(pattern, f):
|
||||
# glob.glob()
|
||||
# if os.path.isfile(f):
|
||||
# os.remove(os.path.join(dir, f))
|
||||
for root, dirnames, filenames in os.walk(dir):
|
||||
for filename in fnmatch.filter(filenames, pattern):
|
||||
f = os.path.join(root, filename)
|
||||
|
@ -111,8 +108,9 @@ class TestTerraform(object):
|
|||
assert s in result
|
||||
|
||||
@pytest.mark.parametrize(*CMD_CASES)
|
||||
def test_cmd(self, method, expected_output, expected_ret_code, expected_logs, string_logger):
|
||||
def test_cmd(self, method, expected_output, expected_ret_code, expected_logs, string_logger, folder):
|
||||
tf = Terraform(working_dir=current_path)
|
||||
tf.init(folder)
|
||||
ret, out, err = method(tf)
|
||||
logs = string_logger()
|
||||
logs = logs.replace('\n', '')
|
||||
|
@ -171,6 +169,7 @@ class TestTerraform(object):
|
|||
)
|
||||
def test_override_default(self, folder, variables):
|
||||
tf = Terraform(working_dir=current_path, variables=variables)
|
||||
tf.init(folder)
|
||||
ret, out, err = tf.apply(folder, var={'test_var': 'test2'},
|
||||
no_color=IsNotFlagged)
|
||||
out = out.replace('\n', '')
|
||||
|
@ -187,6 +186,7 @@ class TestTerraform(object):
|
|||
)
|
||||
def test_output(self, param, string_logger):
|
||||
tf = Terraform(working_dir=current_path, variables={'test_var': 'test'})
|
||||
tf.init('var_to_output')
|
||||
tf.apply('var_to_output')
|
||||
result = tf.output('test_output', **param)
|
||||
regex = re.compile('terraform output (-module=test2 -json|-json -module=test2) test_output')
|
||||
|
@ -198,6 +198,7 @@ class TestTerraform(object):
|
|||
|
||||
def test_destroy(self):
|
||||
tf = Terraform(working_dir=current_path, variables={'test_var': 'test'})
|
||||
tf.init('var_to_output')
|
||||
ret, out, err = tf.destroy('var_to_output')
|
||||
assert ret == 0
|
||||
assert 'Destroy complete! Resources: 0 destroyed.' in out
|
||||
|
|
Loading…
Reference in a new issue