'Testing whether the API returns 200 if a download is being removed'

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

    def verify_removed(_):
        self.assertEqual(len(self.session.get_downloads()), 0)
    (video_tdef, _) = self.create_local_torrent(os.path.join(TESTS_DATA_DIR, 'video.avi'))
    self.session.start_download_from_tdef(video_tdef, DownloadStartupConfig())
    infohash = video_tdef.get_infohash().encode('hex')
    request_deferred = self.do_request(('downloads/%s' % infohash), post_data={'remove_data': True}, expected_code=200, expected_json={'removed': True}, request_type='DELETE')
    return request_deferred.addCallback(verify_removed)
