@@ -123,6 +123,38 @@ def testQueryingOracleWithValidlyFormattedArguments(self):
123123
124124 del (sys .modules ["cx_Oracle" ])
125125
126+ def testInsertingIntoOracleWithInvalidlyFormattedArguments (self ):
127+ cursor = self .mock ()
128+ conn = self .mock ()
129+
130+ sys .modules ["cx_Oracle" ] = self .mock ()
131+ sys .modules ["cx_Oracle" ].expects (once ()).method ("connect" ).will (return_value (conn ))
132+
133+ connection_factory = factory .cxoraConnectionFactory (username = "foo" , password = "bar" , hostname = "localhost" , db = "mock" )
134+ dt = DatabaseTemplate (connection_factory )
135+
136+ self .assertRaises (InvalidArgumentType , dt .execute ,
137+ "INSERT INTO T_UNIT (F_UNIT_PK, F_UNIT_ID, F_NAME) VALUES (?, ?, ?)" ,
138+ (1 ,1 ,1 ))
139+
140+ del (sys .modules ["cx_Oracle" ])
141+
142+ def testInsertingIntoOracleWithInvalidlyFormattedArgumentsWithUpdateApi (self ):
143+ cursor = self .mock ()
144+ conn = self .mock ()
145+
146+ sys .modules ["cx_Oracle" ] = self .mock ()
147+ sys .modules ["cx_Oracle" ].expects (once ()).method ("connect" ).will (return_value (conn ))
148+
149+ connection_factory = factory .cxoraConnectionFactory (username = "foo" , password = "bar" , hostname = "localhost" , db = "mock" )
150+ dt = DatabaseTemplate (connection_factory )
151+
152+ self .assertRaises (InvalidArgumentType , dt .update ,
153+ "INSERT INTO T_UNIT (F_UNIT_PK, F_UNIT_ID, F_NAME) VALUES (?, ?, ?)" ,
154+ (1 ,1 ,1 ))
155+
156+ del (sys .modules ["cx_Oracle" ])
157+
126158class DatabaseTemplateMockTestCase (MockTestCase ):
127159 """Testing the DatabaseTemplate utilizes stubbing and mocking, in order to isolate from different
128160 vendor implementations. This reduces the overhead in making changes to core functionality."""
0 commit comments