@@ -132,11 +132,7 @@ def testQueryingOracleWithValidlyFormattedArguments(self):
132132 del (sys .modules ["cx_Oracle" ])
133133
134134 def testInsertingIntoOracleWithInvalidlyFormattedArguments (self ):
135- cursor = self .mock ()
136- conn = self .mock ()
137-
138135 sys .modules ["cx_Oracle" ] = self .mock ()
139- sys .modules ["cx_Oracle" ].expects (once ()).method ("connect" ).will (return_value (conn ))
140136
141137 connection_factory = factory .cxoraConnectionFactory (username = "foo" , password = "bar" , hostname = "localhost" , db = "mock" )
142138 dt = DatabaseTemplate (connection_factory )
@@ -148,11 +144,7 @@ def testInsertingIntoOracleWithInvalidlyFormattedArguments(self):
148144 del (sys .modules ["cx_Oracle" ])
149145
150146 def testInsertingIntoOracleWithInvalidlyFormattedArgumentsWithUpdateApi (self ):
151- cursor = self .mock ()
152- conn = self .mock ()
153-
154147 sys .modules ["cx_Oracle" ] = self .mock ()
155- sys .modules ["cx_Oracle" ].expects (once ()).method ("connect" ).will (return_value (conn ))
156148
157149 connection_factory = factory .cxoraConnectionFactory (username = "foo" , password = "bar" , hostname = "localhost" , db = "mock" )
158150 dt = DatabaseTemplate (connection_factory )
@@ -163,6 +155,18 @@ def testInsertingIntoOracleWithInvalidlyFormattedArgumentsWithUpdateApi(self):
163155
164156 del (sys .modules ["cx_Oracle" ])
165157
158+ def testInsertingIntoOracleWithInvalidlyFormattedArgumentsWithInsertApi (self ):
159+ sys .modules ["cx_Oracle" ] = self .mock ()
160+
161+ connection_factory = factory .cxoraConnectionFactory (username = "foo" , password = "bar" , hostname = "localhost" , db = "mock" )
162+ dt = DatabaseTemplate (connection_factory )
163+
164+ self .assertRaises (InvalidArgumentType , dt .insert_and_return_id ,
165+ "INSERT INTO T_UNIT (F_UNIT_PK, F_UNIT_ID, F_NAME) VALUES (?, ?, ?)" ,
166+ (1 ,1 ,1 ))
167+
168+ del (sys .modules ["cx_Oracle" ])
169+
166170class DatabaseTemplateMockTestCase (MockTestCase ):
167171 """Testing the DatabaseTemplate utilizes stubbing and mocking, in order to isolate from different
168172 vendor implementations. This reduces the overhead in making changes to core functionality."""
0 commit comments