#NEWLINE# def testStartInstance_created( self ) : #NEWLINE# #INDENT# mock_api = MagicMock ( name = 'Mock API' ) #NEWLINE# self . manager . GetApi = MagicMock ( return_value = mock_api ) #NEWLINE# mock_builtin_open = patch ( '__builtin__.open' ) . start ( ) #NEWLINE# property_mock = PropertyMock ( side_effect = HttpError ( 'resp' , 'content' ) ) #NEWLINE# mock_api . GetInstance = property_mock #NEWLINE# self . assertTrue ( self . manager . StartInstance ( ) ) #NEWLINE# mock_api . GetInstance . assert_called_once_with ( 'myinstance' ) #NEWLINE# self . assertTrue ( mock_api . CreateInstance . called ) #NEWLINE# self . assertTrue ( mock_builtin_open . called )