@@ -131,6 +131,42 @@ def testQueryingOracleWithValidlyFormattedArguments(self):
131
131
132
132
del (sys .modules ["cx_Oracle" ])
133
133
134
+ def testInsertingIntoOracleWithInvalidlyFormattedArguments (self ):
135
+ sys .modules ["cx_Oracle" ] = self .mock ()
136
+
137
+ connection_factory = factory .cxoraConnectionFactory (username = "foo" , password = "bar" , hostname = "localhost" , db = "mock" )
138
+ dt = DatabaseTemplate (connection_factory )
139
+
140
+ self .assertRaises (InvalidArgumentType , dt .execute ,
141
+ "INSERT INTO T_UNIT (F_UNIT_PK, F_UNIT_ID, F_NAME) VALUES (?, ?, ?)" ,
142
+ (1 ,1 ,1 ))
143
+
144
+ del (sys .modules ["cx_Oracle" ])
145
+
146
+ def testInsertingIntoOracleWithInvalidlyFormattedArgumentsWithUpdateApi (self ):
147
+ sys .modules ["cx_Oracle" ] = self .mock ()
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
+
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
+
134
170
class DatabaseTemplateMockTestCase (MockTestCase ):
135
171
"""Testing the DatabaseTemplate utilizes stubbing and mocking, in order to isolate from different
136
172
vendor implementations. This reduces the overhead in making changes to core functionality."""
0 commit comments