def test_flow_success(self): """Test run delta with successful flow. * Runs a flow with success blocks. * Validates all the tests were run. * Runs the same suite with delta flag. * Validates that the flow didn't run again. * Runs the same suite with delta flag. * Validates that the flow didn't run again. """ MockFlow.blocks = (SuccessBlock, SkipBlock, SuccessBlock) main_test = MockFlow() result = self.create_result(main_test) main_test.run(result) self.validate_result(result, True, successes=1) main_test = MockFlow(run_data=self.run_data) delta_result = self.create_result(main_test) main_test.run(delta_result) self.validate_result(delta_result, None, skips=1) main_test = MockFlow(run_data=self.run_data) delta_result = self.create_result(main_test) main_test.run(delta_result) self.validate_result(delta_result, None, skips=1)
def test_failing_flow(self): """Test run delta with failing flow. * Runs a flow with success failure & skipped blocks. * Validates all the block were run. * Runs the same flow with delta flag. * Validates that all the blocks ran again. """ MockFlow.blocks = (SuccessBlock, SkipBlock, FailureBlock) main_test = MockFlow() result = self.create_result(main_test) main_test.run(result) self.validate_result(result, False, fails=1) block_results1 = [block.data.exception_type for block in main_test] main_test = MockFlow(run_data=self.run_data) delta_result = self.create_result(main_test) main_test.run(delta_result) self.validate_result(delta_result, False, fails=1) block_results2 = [block.data.exception_type for block in main_test] self.assertEqual(block_results1, block_results2)