(self, event_loop, file_svc)
| 176 | os.rmdir(upload_dir) |
| 177 | |
| 178 | def test_encrypt_upload(self, event_loop, file_svc): |
| 179 | upload_dir = event_loop.run_until_complete(file_svc.create_exfil_sub_directory('test-encrypted-upload')) |
| 180 | upload_filename = 'encryptedupload.txt' |
| 181 | upload_content = b'this is a test upload file' |
| 182 | event_loop.run_until_complete(file_svc.save_file(upload_filename, upload_content, upload_dir)) |
| 183 | uploaded_file_path = os.path.join(upload_dir, upload_filename) |
| 184 | decrypted_file_path = upload_filename + '_decrypted' |
| 185 | config_to_use = 'conf/default.yml' |
| 186 | with open(config_to_use, encoding='utf-8') as conf: |
| 187 | config = list(yaml.load_all(conf, Loader=yaml.FullLoader))[0] |
| 188 | decrypt(uploaded_file_path, config, output_file=decrypted_file_path) |
| 189 | assert os.path.isfile(decrypted_file_path) |
| 190 | with open(decrypted_file_path, 'rb') as decrypted_file: |
| 191 | decrypted_data = decrypted_file.read() |
| 192 | assert decrypted_data == upload_content |
| 193 | os.remove(uploaded_file_path) |
| 194 | os.remove(decrypted_file_path) |
| 195 | os.rmdir(upload_dir) |
| 196 | |
| 197 | def test_walk_file_path_exists_nonxor(self, event_loop, text_file, file_svc): |
| 198 | ret = event_loop.run_until_complete(file_svc.walk_file_path(text_file.dirname, text_file.basename)) |
nothing calls this directly
no test coverage detected