'Test the creation of a torrent in the search community'

@blocking_call_on_reactor_thread
def test_create_torrent(self):

    with open(os.path.join(TESTS_DATA_DIR, 'bak_single.torrent'), mode='rb') as torrent_file:
        torrent_data = torrent_file.read()
    mock_session = MockObject()
    mock_session.get_collected_torrent = (lambda _: torrent_data)
    mock_session.open_dbhandler = (lambda _: None)
    mock_session.notifier = None
    mock_session.lm = MockObject()
    mock_session.lm.rtorrent_handler = None
    self.search_community.initialize(mock_session)
    self.search_community._torrent_db = MockObject()
    self.search_community._torrent_db.updateTorrent = (lambda *_, **ignored: None)
    self.assertTrue(self.search_community.create_torrent(('a' * 20)))
