From f1db7d4b218e6edbad2422b170af256d5247cb4e Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Mon, 30 Jan 2017 05:08:09 +0300 Subject: test: code style --- test/toolkit.py | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) (limited to 'test/toolkit.py') diff --git a/test/toolkit.py b/test/toolkit.py index b4d0d08..bc27dc8 100644 --- a/test/toolkit.py +++ b/test/toolkit.py @@ -123,15 +123,17 @@ class Tools: return args def run_encrypt_block(self, algorithm, mode, inputs, use_boxes=False): - return self.run(self._ENCRYPT_BLOCK, - self._build_block_args(algorithm, mode, inputs, use_boxes)) + args = self._build_block_args(algorithm, mode, inputs, use_boxes) + return self.run(self._ENCRYPT_BLOCK, args) def run_decrypt_block(self, algorithm, mode, inputs, use_boxes=False): - return self.run(self._DECRYPT_BLOCK, - self._build_block_args(algorithm, mode, inputs, use_boxes)) + args = self._build_block_args(algorithm, mode, inputs, use_boxes) + return self.run(self._DECRYPT_BLOCK, args) @staticmethod - def _file_settings_to_args(algorithm, mode, key, input_path, output_path, iv=None): + def _build_file_args( + algorithm, mode, key, input_path, output_path, iv=None): + args = [ '--algorithm', str(algorithm), '--mode', str(mode), @@ -143,10 +145,16 @@ class Tools: args.extend(('--iv', iv)) return args - def run_encrypt_file(self, algorithm, mode, key, input_path, output_path, iv=None): - return self.run(self._ENCRYPT_FILE, - self._file_settings_to_args(algorithm, mode, key, input_path, output_path, iv)) + def run_encrypt_file( + self, algorithm, mode, key, input_path, output_path, iv=None): + + args = self._build_file_args( + algorithm, mode, key, input_path, output_path, iv) + return self.run(self._ENCRYPT_FILE, args) + + def run_decrypt_file( + self, algorithm, mode, key, input_path, output_path, iv=None): - def run_decrypt_file(self, algorithm, mode, key, input_path, output_path, iv=None): - return self.run(self._DECRYPT_FILE, - self._file_settings_to_args(algorithm, mode, key, input_path, output_path, iv)) + args = self._build_file_args( + algorithm, mode, key, input_path, output_path, iv) + return self.run(self._DECRYPT_FILE, args) -- cgit v1.2.3