def set_key(): """ Set up a keyfile and set the value of the key in the kernel keyring. """ with NamedTemporaryFile(mode="w") as temp_file: temp_file.write("test-password") temp_file.flush() StratisDbus.set_key(key_desc, temp_file)
def test_key_set_unset(self): """ Test setting a key. """ key_desc = "test-description" with NamedTemporaryFile(mode="w") as temp_file: temp_file.write("test-password") temp_file.flush() self._unittest_command(StratisDbus.set_key(key_desc, temp_file), dbus.UInt16(0)) self._unittest_command(StratisDbus.unset_key(key_desc), dbus.UInt16(0))