Exemplo n.º 1
0
 def create_file(self, filename):
     handle = mocks.GenFile(3 * MB, b'1')
     key = b'2' * (AES.block_size // 8)
     out = yield EncryptedFileCreator.create_lbry_file(
         self.blob_manager, self.storage, self.prm, self.lbry_file_manager,
         filename, handle, key, iv_generator())
     defer.returnValue(out)
Exemplo n.º 2
0
 def create_stream():
     test_file = mocks.GenFile(
         5209343, b''.join([chr(i + 3) for i in xrange(0, 64, 6)]))
     d = LBRYFileCreator.create_lbry_file(self.session,
                                          self.lbry_file_manager,
                                          "test_file",
                                          test_file,
                                          key="0123456701234567",
                                          iv_generator=iv_generator())
     return d
 def create_file(self, filename):
     session = mock.Mock(spec=Session.Session)(None, None)
     hash_announcer = DHTHashAnnouncer.DHTHashAnnouncer(None, None)
     session.blob_manager = BlobManager.TempBlobManager(hash_announcer)
     session.db_dir = self.tmp_dir
     manager = mock.Mock(spec=EncryptedFileManager.EncryptedFileManager)()
     handle = mocks.GenFile(3 * MB, '1')
     key = '2' * AES.block_size
     return EncryptedFileCreator.create_lbry_file(session, manager,
                                                  filename, handle, key,
                                                  iv_generator())
Exemplo n.º 4
0
 def create_stream():
     test_file = mocks.GenFile(5209343,
                               bytes((i + 3) for i in range(0, 64, 6)))
     d = EncryptedFileCreator.create_lbry_file(
         self.client_blob_manager,
         self.client_storage,
         prm,
         self.client_lbry_file_manager,
         "test_file",
         test_file,
         key=b"0123456701234567",
         iv_generator=iv_generator())
     d.addCallback(lambda lbry_file: lbry_file.stream_hash)
     return d
Exemplo n.º 5
0
 def create_file(self, filename):
     session = mock.Mock(spec=Session.Session)(None, None)
     hash_announcer = DHTHashAnnouncer.DHTHashAnnouncer(None, None)
     self.blob_manager = BlobManager.DiskBlobManager(
         hash_announcer, self.tmp_blob_dir, self.tmp_db_dir)
     session.blob_manager = self.blob_manager
     yield session.blob_manager.setup()
     session.db_dir = self.tmp_db_dir
     manager = mock.Mock(spec=EncryptedFileManager.EncryptedFileManager)()
     handle = mocks.GenFile(3 * MB, '1')
     key = '2' * AES.block_size
     out = yield EncryptedFileCreator.create_lbry_file(
         session, manager, filename, handle, key, iv_generator())
     defer.returnValue(out)