lbry-sdk/lbrynet/tests/unit/lbryfile/client/test_EncryptedFileDownloader.py
2018-01-04 21:25:56 -05:00

33 lines
1.1 KiB
Python

import os.path
from twisted.trial import unittest
from twisted.internet import defer
from lbrynet.lbry_file.client.EncryptedFileDownloader import EncryptedFileSaver
class TestEncryptedFileSaver(unittest.TestCase):
@defer.inlineCallbacks
def test_setup_output(self):
file_name = 'encrypted_file_saver_test.tmp'
self.assertFalse(os.path.isfile(file_name))
# create file in the temporary trial folder
stream_hash = ''
peer_finder = None
rate_limiter = None
blob_manager = None
stream_info_manager = None
payment_rate_manager = None
wallet = None
download_directory = '.'
key = ''
saver = EncryptedFileSaver(stream_hash, peer_finder, rate_limiter, blob_manager,
stream_info_manager, payment_rate_manager, wallet,
download_directory, key, file_name, file_name,
file_name)
yield saver._setup_output()
self.assertTrue(os.path.isfile(file_name))
saver._close_output()