'Testing whether the API finds channels/torrents when searching if there is some inserted data in the database'

@deferred(timeout=10)
def test_search(self):

    self.insert_channels_in_db(5)
    self.insert_torrents_in_db(6)
    self.expected_num_results_list = [5, 6, 0, 0]
    self.session.config.get_torrent_search_enabled = (lambda : True)
    self.session.config.get_channel_search_enabled = (lambda : True)
    self.session.lm.search_manager = FakeSearchManager(self.session.notifier)
    expected_json = {'queried': True}
    return self.do_request('search?q=test', expected_code=200, expected_json=expected_json).addCallback(self.verify_search_results)
