@@ -218,29 +218,15 @@ def totp_invalid_format_scenario(self):
218218 cur .execute ("DROP AUTHENTICATION IF EXISTS totp_auth CASCADE" )
219219
220220 def test_totp_invalid_alphanumeric_code (self ):
221- # Verify alphanumeric TOTP inputs return the explicit validation error
222- with self ._connect () as conn :
223- cur = conn .cursor ()
224-
225- cur .execute ("DROP USER IF EXISTS totp_user" )
226- cur .execute ("DROP AUTHENTICATION IF EXISTS totp_auth CASCADE" )
227-
228- try :
229- cur .execute ("CREATE USER totp_user IDENTIFIED BY 'password' ENFORCEMFA" )
230- cur .execute ("CREATE AUTHENTICATION totp_auth METHOD 'password' HOST '0.0.0.0/0'" )
231- cur .execute ("GRANT AUTHENTICATION totp_auth TO totp_user" )
232-
233- self ._conn_info ['user' ] = 'totp_user'
234- self ._conn_info ['password' ] = 'password'
235- # Alphanumeric TOTP provided via driver parameter
236- self ._conn_info ['totp' ] = "ot123"
237-
238- err_msg = "Invalid TOTP: Please enter a valid 6-digit numeric code"
239- self .assertConnectionFail (err_msg = err_msg )
240-
241- finally :
242- cur .execute ("DROP USER IF EXISTS totp_user" )
243- cur .execute ("DROP AUTHENTICATION IF EXISTS totp_auth CASCADE" )
221+ # Verify alphanumeric TOTP inputs return explicit client-side validation error
222+ try :
223+ # Provide alphanumeric TOTP via connection options; should fail locally
224+ self ._conn_info ['totp' ] = "ot123"
225+ err_msg = "Invalid TOTP: Please enter a valid 6-digit numeric code."
226+ self .assertConnectionFail (err_msg = err_msg )
227+ finally :
228+ # Clean up connection options
229+ self ._conn_info .pop ('totp' , None )
244230
245231 # Negative Test: Wrong TOTP (Valid format, wrong value)
246232 def totp_wrong_code_scenario (self ):
0 commit comments