@@ -131,6 +131,38 @@ def testQueryingOracleWithValidlyFormattedArguments(self):
131
131
132
132
del (sys .modules ["cx_Oracle" ])
133
133
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
+
134
166
class DatabaseTemplateMockTestCase (MockTestCase ):
135
167
"""Testing the DatabaseTemplate utilizes stubbing and mocking, in order to isolate from different
136
168
vendor implementations. This reduces the overhead in making changes to core functionality."""
0 commit comments