def testIssuingInteractionRecordCommand(self): with action_runner_module.Interaction(self.mock_action_runner, label='ABC', flags=[]): pass self.assertEqual(self.expected_calls, self.mock_action_runner.mock_calls)
def testIssuingInteractionRecordCommand(self): with action_runner_module.Interaction( self.mock_action_runner, label='ABC', flags=[]): pass expected_calls = [ mock.call.ExecuteJavaScript('console.time("Interaction.ABC");'), mock.call.ExecuteJavaScript('console.timeEnd("Interaction.ABC");')] self.assertEqual(expected_calls, self.mock_action_runner.mock_calls)
def testExceptionRaisedInWithInteraction(self): class FooException(Exception): pass # Test that the Foo exception raised in the with block is propagated to the # caller. with self.assertRaises(FooException): with action_runner_module.Interaction( self.mock_action_runner, label='ABC', flags=[]): raise FooException() # Test that the end console.timeEnd(...) isn't called because exception was # raised. self.assertEqual( self.expected_calls[:1], self.mock_action_runner.mock_calls)