#NEWLINE# def testCreateFirewall_created( self ) : #NEWLINE# #INDENT# 'Unit test of CreateFirewall() where a firewall is created.' #NEWLINE# mock_api = MagicMock ( name = 'Mock Google Client API' ) #NEWLINE# self . gce_api . GetApi = MagicMock ( return_value = mock_api ) #NEWLINE# property_mock = PropertyMock ( side_effect = apiclient . errors . HttpError ( 'resp' , 'content' ) ) #NEWLINE# mock_api . firewalls . return_value . get = mock_api #NEWLINE# self . assertTrue ( self . gce_api . CreateFirewall ( 'firewall-name' , [ { #NEWLINE# #INDENT# 'IPProtocol' : 'tcp' , #NEWLINE# #UNINDENT# } ] ) ) #NEWLINE# mock_api . firewalls . return_value . insert . assert_called_once_with ( project = 'project-name' , body = mock . ANY ) #NEWLINE# mock_api . firewalls . return_value . insert . return_value . execute . assert_called_once_with ( )