def test_with_post_processing(self): def done(result): report = oreporter.dummy_report self.assertEqual(len(report), 6) for entry in report: if entry['test_name'] == 'summary': self.assertEqual(entry['report'], {'antani': 'sblinda'}) input_unit = InputUnit([None]) cmd_line_options = {'collector': None} oreporter = DummyReporter(cmd_line_options) oreporter.dummy_report = [] test_cases, options = loadTestsAndOptions([DummyTestCasePP], cmd_line_options) d = runTestCasesWithInputUnit(test_cases, input_unit, oreporter, oreporter) d.addBoth(done) return d
def test_run_testcase_with_input_unit(self): def done(result): report = oreporter.dummy_report self.assertEqual(len(report), 10*2) # XXX debug why this is failing # for idx, entry in enumerate(oreporter.dummy_report): # if idx % 2 == 0: # self.assertEqual(entry['report']['foo'], 'foo') # else: # self.assertEqual(entry['report']['bar'], 'bar') input_unit = InputUnit([0,1,2,3,4]) cmd_line_options = {'collector': None} oreporter = DummyReporter(cmd_line_options) oreporter.dummy_report = [] test_cases, options = loadTestsAndOptions([DummyTestCase], cmd_line_options) d = runTestCasesWithInputUnit(test_cases, input_unit, oreporter, oreporter) d.addBoth(done) return d