Changeset: 7e379cfaffaf for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/7e379cfaffaf Modified Files: sql/odbc/tests/Tests/ODBCconnect.py testing/Mtest.py.in Branch: Aug2024 Log Message:
Test SQLDriverConnect diffs (121 lines): diff --git a/sql/odbc/tests/Tests/ODBCconnect.py b/sql/odbc/tests/Tests/ODBCconnect.py --- a/sql/odbc/tests/Tests/ODBCconnect.py +++ b/sql/odbc/tests/Tests/ODBCconnect.py @@ -14,9 +14,16 @@ # sqlstate lines of the form ' - STATE: MESSAGE'. import atexit +import os import subprocess import sys +dsn = 'MonetDB-Test' +dbname = os.environ.get('TSTDB', 'demo') +user = 'monetdb' +password = 'monetdb' +port = os.environ.get('MAPIPORT', 50000) + class Execution: def __init__(self, *odbcconnect_args): @@ -97,38 +104,35 @@ def show_context(): print(ex.report(), file=sys.stderr) -dbname = 'MonetDB-Test' - - -ex = Execution(dbname) +ex = Execution(dsn) ex.expect('OK') ex.end() -ex = Execution(dbname + '-nonexistent') +ex = Execution(dsn + '-nonexistent') ex.expect_fail() ex.expect('Error') ex.expect('IM002:') # IM002 not found ex.end() -ex = Execution(dbname, '-p', 'wrongpassword') +ex = Execution(dsn, '-p', 'wrongpassword') ex.expect_fail() ex.expect('Error') ex.expect('28000:') # 28000 bad credentials ex.end() -ex = Execution(dbname, '-u', 'wronguser') +ex = Execution(dsn, '-u', 'wronguser') ex.expect_fail() ex.expect('Error') ex.expect('28000:') # 28000 bad credentials ex.end() -ex = Execution(dbname, '-p', '') +ex = Execution(dsn, '-p', '') ex.expect_fail() ex.expect('Error') ex.expect('28000:') # 28000 bad credentials ex.end() -ex = Execution(dbname, '-u', '') +ex = Execution(dsn, '-u', '') ex.expect_fail() ex.expect('Error') ex.expect('28000:') # 28000 bad credentials @@ -136,13 +140,33 @@ ex.end() # test non-NUL terminated strings -ex = Execution(dbname, '-0') +ex = Execution(dsn, '-0') +ex.expect('OK') +ex.end() + +ex = Execution(dsn, '-0', '-u', user, '-p', password) +ex.expect('OK') +ex.end() + +# test connection strings + +ex = Execution('-d', f'DSN={dsn}') ex.expect('OK') ex.end() -ex = Execution(dbname, '-0', '-u', 'monetdb', '-p', 'monetdb') +# override things that are already set in the dsn +ex = Execution('-d', f'DSN={dsn}-Wrong;Database={dbname};Uid={user};Pwd={password}') ex.expect('OK') ex.end() +# .. even if the DSN= comes last +ex = Execution('-d', f'Database={dbname};Uid={user};Pwd={password};DSN={dsn}-Wrong') +ex.expect('OK') +ex.end() + +# test without DSN= clause +ex = Execution('-d', f'DRIVER={{MonetDB}};Database={dbname};Uid={user};Pwd={password};Port={port}') +ex.expect('OK') +ex.end() ex = None diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in --- a/testing/Mtest.py.in +++ b/testing/Mtest.py.in @@ -2227,6 +2227,16 @@ Database = {TSTDB} User = {user or "monetdb"} Password = {passwd or "monetdb"} Debug = + +[MonetDB-Test-Wrong] +Description = Wrong values for Database, Uid and Pwd +Driver = {env["LIBDIR"]}/libMonetODBC.so +Setup = {env["LIBDIR"]}/libMonetODBCs.so +Host = localhost +Port = {env["MAPIPORT"]} +Database = {TSTDB}-Wrong +User = {user or "monetdb"}-Wrong +Password = {passwd or "monetdb"}-Wrong ''') f.close() os.environ['ODBCINI'] = os.path.join(TSTTRGDIR, 'odbc.ini') _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org