'Testing whether changing the configuration on runtime calls the right methods in LibtorrentDownloadImpl'

def test_dlconfig_cb_change(self):

    def mocked_set_upload_limit(prio):
        self.assertEqual(prio, (3 * 1024))
        mocked_set_upload_limit.called = True
    mocked_set_upload_limit.called = False
    self.libtorrent_download_impl.handle.set_upload_limit = mocked_set_upload_limit
    def mocked_set_download_limit(prio):
        self.assertEqual(prio, (3 * 1024))
        mocked_set_download_limit.called = True
    mocked_set_download_limit.called = False
    self.libtorrent_download_impl.handle.set_download_limit = mocked_set_download_limit
    self.libtorrent_download_impl.dlconfig_changed_callback('libtorrent', 'max_upload_rate', 3, 4)
    self.assertTrue(mocked_set_upload_limit)
    self.libtorrent_download_impl.dlconfig_changed_callback('libtorrent', 'max_download_rate', 3, 4)
    self.assertTrue(mocked_set_download_limit)
    self.assertFalse(self.libtorrent_download_impl.dlconfig_changed_callback('download_defaults', 'super_seeder', 3, 4))
