@@ -131,6 +131,38 @@ def testQueryingOracleWithValidlyFormattedArguments(self):
131131
132132 del (sys .modules ["cx_Oracle" ])
133133
134+ def testInsertingIntoOracleWithInvalidlyFormattedArguments (self ):
135+ cursor = self .mock ()
136+ conn = self .mock ()
137+
138+ sys .modules ["cx_Oracle" ] = self .mock ()
139+ sys .modules ["cx_Oracle" ].expects (once ()).method ("connect" ).will (return_value (conn ))
140+
141+ connection_factory = factory .cxoraConnectionFactory (username = "foo" , password = "bar" , hostname = "localhost" , db = "mock" )
142+ dt = DatabaseTemplate (connection_factory )
143+
144+ self .assertRaises (InvalidArgumentType , dt .execute ,
145+ "INSERT INTO T_UNIT (F_UNIT_PK, F_UNIT_ID, F_NAME) VALUES (?, ?, ?)" ,
146+ (1 ,1 ,1 ))
147+
148+ del (sys .modules ["cx_Oracle" ])
149+
150+ def testInsertingIntoOracleWithInvalidlyFormattedArgumentsWithUpdateApi (self ):
151+ cursor = self .mock ()
152+ conn = self .mock ()
153+
154+ sys .modules ["cx_Oracle" ] = self .mock ()
155+ sys .modules ["cx_Oracle" ].expects (once ()).method ("connect" ).will (return_value (conn ))
156+
157+ connection_factory = factory .cxoraConnectionFactory (username = "foo" , password = "bar" , hostname = "localhost" , db = "mock" )
158+ dt = DatabaseTemplate (connection_factory )
159+
160+ self .assertRaises (InvalidArgumentType , dt .update ,
161+ "INSERT INTO T_UNIT (F_UNIT_PK, F_UNIT_ID, F_NAME) VALUES (?, ?, ?)" ,
162+ (1 ,1 ,1 ))
163+
164+ del (sys .modules ["cx_Oracle" ])
165+
134166class DatabaseTemplateMockTestCase (MockTestCase ):
135167 """Testing the DatabaseTemplate utilizes stubbing and mocking, in order to isolate from different
136168 vendor implementations. This reduces the overhead in making changes to core functionality."""
0 commit comments