Commit c4b2540e by Abhijit Menon-Sen

Update tests for VaultEditor API changes

parent 20fd9224
...@@ -81,7 +81,7 @@ class TestVaultEditor(unittest.TestCase): ...@@ -81,7 +81,7 @@ class TestVaultEditor(unittest.TestCase):
pass pass
def test_methods_exist(self): def test_methods_exist(self):
v = VaultEditor(None, None, None) v = VaultEditor(None)
slots = ['create_file', slots = ['create_file',
'decrypt_file', 'decrypt_file',
'edit_file', 'edit_file',
...@@ -103,8 +103,8 @@ class TestVaultEditor(unittest.TestCase): ...@@ -103,8 +103,8 @@ class TestVaultEditor(unittest.TestCase):
tmp_file = tempfile.NamedTemporaryFile() tmp_file = tempfile.NamedTemporaryFile()
os.unlink(tmp_file.name) os.unlink(tmp_file.name)
ve = VaultEditor(None, "ansible", tmp_file.name) ve = VaultEditor("ansible")
ve.create_file() ve.create_file(tmp_file.name)
self.assertTrue(os.path.exists(tmp_file.name)) self.assertTrue(os.path.exists(tmp_file.name))
...@@ -120,12 +120,12 @@ class TestVaultEditor(unittest.TestCase): ...@@ -120,12 +120,12 @@ class TestVaultEditor(unittest.TestCase):
with v10_file as f: with v10_file as f:
f.write(to_bytes(v10_data)) f.write(to_bytes(v10_data))
ve = VaultEditor(None, "ansible", v10_file.name) ve = VaultEditor("ansible")
# make sure the password functions for the cipher # make sure the password functions for the cipher
error_hit = False error_hit = False
try: try:
ve.decrypt_file() ve.decrypt_file(v10_file.name)
except errors.AnsibleError as e: except errors.AnsibleError as e:
error_hit = True error_hit = True
...@@ -148,12 +148,12 @@ class TestVaultEditor(unittest.TestCase): ...@@ -148,12 +148,12 @@ class TestVaultEditor(unittest.TestCase):
with v11_file as f: with v11_file as f:
f.write(to_bytes(v11_data)) f.write(to_bytes(v11_data))
ve = VaultEditor(None, "ansible", v11_file.name) ve = VaultEditor("ansible")
# make sure the password functions for the cipher # make sure the password functions for the cipher
error_hit = False error_hit = False
try: try:
ve.decrypt_file() ve.decrypt_file(v11_file.name)
except errors.AnsibleError as e: except errors.AnsibleError as e:
error_hit = True error_hit = True
...@@ -180,12 +180,12 @@ class TestVaultEditor(unittest.TestCase): ...@@ -180,12 +180,12 @@ class TestVaultEditor(unittest.TestCase):
with v10_file as f: with v10_file as f:
f.write(to_bytes(v10_data)) f.write(to_bytes(v10_data))
ve = VaultEditor(None, "ansible", v10_file.name) ve = VaultEditor("ansible")
# make sure the password functions for the cipher # make sure the password functions for the cipher
error_hit = False error_hit = False
try: try:
ve.rekey_file('ansible2') ve.rekey_file('ansible2', v10_file.name)
except errors.AnsibleError as e: except errors.AnsibleError as e:
error_hit = True error_hit = True
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment