@@ -0,0 +1,1350 @@
+import unittest%0Aimport os%0Afrom io import BytesIO%0Afrom random import randint%0Afrom hashlib import sha256%0Afrom telethon import TelegramClient%0A%0A# Fill in your api_id and api_hash when running the tests%0A# and REMOVE THEM once you've finished testing them.%0Aapi_id = None%0Aapi_hash = None%0A%0Aif not api_id or not api_hash:%0A    raise ValueError('Please fill in both your api_id and api_hash.')%0A%0Aclass HigherLevelTests(unittest.TestCase):%0A%0A    @staticmethod%0A    def test_cdn_download():%0A        client = TelegramClient(None, api_id, api_hash)%0A        client.session.server_address = '149.154.167.40'%0A        assert client.connect()%0A%0A        try:%0A            phone = '+999662' + str(randint(0, 9999)).zfill(4)%0A            client.send_code_request(phone)%0A            client.sign_up(phone, '22222', 'Test', 'DC')%0A%0A            me = client.get_me()%0A            data = os.urandom(2 ** 17)%0A            client.send_file(%0A                me, data,%0A                progress_callback=lambda c, t:%0A                    print('test_cdn_download:uploading %7B:.2%25%7D...'.format(c/t))%0A            )%0A            msg = client.get_message_history(me)%5B1%5D%5B0%5D%0A%0A            out = BytesIO()%0A            client.download_media(msg, out)%0A            assert sha256(data).digest() == sha256(out.getvalue()).digest()%0A%0A            client.log_out()%0A        finally:%0A            client.disconnect()%0A

Add a unit test for CDN-downloads