import asyncio import sys import pathlib import os test_file = pathlib.Path(__file__) project = test_file.parent.parent sys.path.append(str(project)) import server_source as source from test import test async def main(): text = "This is sample encrypted text." print("Encoding text: ") print("\"" + text + "\"") encrypted = await source.decoded(text).encode() print("Encoded: ") print("\"" + str(encrypted) + "\"") decrypted = await encrypted.decode() test(text, str(decrypted)) print("Testing on random bytes...") blob = os.urandom(1024 * 1024 * 100) encrypted_blob = await source.decoded(blob).encode() print("Encrypted. Decrypting...") decrypted_blob = await encrypted_blob.decode() test(blob, bytes(decrypted_blob)) asyncio.run(main())