'Testing whether the right availability of a file is returned'

def test_get_availability(self):

    download_state = DownloadState(self.mock_download, DLSTATUS_DOWNLOADING, None, 0.6)
    download_state.stats = {'spew': [{}]}
    self.assertEqual(download_state.get_availability(), 0)
    download_state.stats = {'spew': [{'completed': 1.0}]}
    self.assertEqual(download_state.get_availability(), 1.0)
    download_state.stats = {'spew': [{'completed': 0.6}]}
    self.assertEqual(download_state.get_availability(), 0.0)
