def test_generate_report_all_failure(self): m = multiprocessing.Manager() q = m.Queue() q.put(('failure', 'name1')) q.put(('failure', 'name2')) report = wc.generate_report(q) assert report == ('Total downloads attempted: 2\n' 'Successful downloads: 0\n' 'Failed downloads: 2\n') m.shutdown()
def test_generate_report_one_failure(self): m = multiprocessing.Manager() q = m.Queue() q.put(('success', 'name1')) q.put(('failure', 'name2')) report = wc.generate_report(q) assert report == ('Total downloads attempted: 2\n' 'Successful downloads: 1\n' 'Failed downloads: 1\n' 'Failed files (see log for details):\n' ' name2\n') m.shutdown()