def test_progress_zero_by_zero(self):
        app_state = AppState()

        new_conf = DownloadConfiguration(number_of_images=0,
                                         images_per_category=83,
                                         download_destination='481516')

        app_state.set_configuration(new_conf)

        self.assertAlmostEqual(app_state.calculate_progress(), 0)
    def test_progress(self):
        app_state = AppState()

        new_conf = DownloadConfiguration(number_of_images=10,
                                         images_per_category=83,
                                         download_destination='481516')

        last_result = Result(failed_urls=['1', 'one'], succeeded_urls=['x'])
        progress_info = ProgressInfo(total_downloaded=9,
                                     total_failed=38,
                                     finished=False,
                                     last_result=last_result)

        app_state.set_configuration(new_conf)
        app_state.set_progress_info(progress_info)

        self.assertAlmostEqual(app_state.calculate_progress(), 0.9)