@@ -132,11 +132,7 @@ def testQueryingOracleWithValidlyFormattedArguments(self):
132
132
del (sys .modules ["cx_Oracle" ])
133
133
134
134
def testInsertingIntoOracleWithInvalidlyFormattedArguments (self ):
135
- cursor = self .mock ()
136
- conn = self .mock ()
137
-
138
135
sys .modules ["cx_Oracle" ] = self .mock ()
139
- sys .modules ["cx_Oracle" ].expects (once ()).method ("connect" ).will (return_value (conn ))
140
136
141
137
connection_factory = factory .cxoraConnectionFactory (username = "foo" , password = "bar" , hostname = "localhost" , db = "mock" )
142
138
dt = DatabaseTemplate (connection_factory )
@@ -148,11 +144,7 @@ def testInsertingIntoOracleWithInvalidlyFormattedArguments(self):
148
144
del (sys .modules ["cx_Oracle" ])
149
145
150
146
def testInsertingIntoOracleWithInvalidlyFormattedArgumentsWithUpdateApi (self ):
151
- cursor = self .mock ()
152
- conn = self .mock ()
153
-
154
147
sys .modules ["cx_Oracle" ] = self .mock ()
155
- sys .modules ["cx_Oracle" ].expects (once ()).method ("connect" ).will (return_value (conn ))
156
148
157
149
connection_factory = factory .cxoraConnectionFactory (username = "foo" , password = "bar" , hostname = "localhost" , db = "mock" )
158
150
dt = DatabaseTemplate (connection_factory )
@@ -163,6 +155,18 @@ def testInsertingIntoOracleWithInvalidlyFormattedArgumentsWithUpdateApi(self):
163
155
164
156
del (sys .modules ["cx_Oracle" ])
165
157
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
+
166
170
class DatabaseTemplateMockTestCase (MockTestCase ):
167
171
"""Testing the DatabaseTemplate utilizes stubbing and mocking, in order to isolate from different
168
172
vendor implementations. This reduces the overhead in making changes to core functionality."""
0 commit comments