Skip to content

Commit

Permalink
Make connection params tests work also for pyodbc
Browse files Browse the repository at this point in the history
  • Loading branch information
amochin committed Sep 25, 2024
1 parent 36e2550 commit 946c259
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 9 deletions.
1 change: 1 addition & 0 deletions test/resources/config_files/pyodbc/charset_invalid.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ user=db_user
password=pass
dbHost=127.0.0.1
dbPort=3306
dbDriver={MySQL ODBC 8.0 ANSI Driver}
dbCharset=wrong
5 changes: 3 additions & 2 deletions test/resources/config_files/pyodbc/custom_param_password.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[default]
dbapiModuleName=pyodbc
dbName=db
password=pass
PWD=pass
dbHost=127.0.0.1
dbPort=3306
dbPort=3306
dbDriver={MySQL ODBC 8.0 ANSI Driver}
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ dbUsername=db_user
dbPassword=pass
dbHost=127.0.0.1
dbPort=3306
dbDriver={MySQL ODBC 8.0 ANSI Driver}
blah=blah
3 changes: 2 additions & 1 deletion test/resources/config_files/pyodbc/simple_default_alias.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ dbName=db
dbUsername=db_user
dbPassword=pass
dbHost=127.0.0.1
dbPort=3306
dbPort=3306
dbDriver={MySQL ODBC 8.0 ANSI Driver}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[default]
dbapiModuleName=pyodbc
dbName=db
dbName=db
dbDriver={MySQL ODBC 8.0 ANSI Driver}
7 changes: 4 additions & 3 deletions test/resources/config_files/pyodbc/valid_custom_params.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[default]
dbapiModuleName=pyodbc
dbName=db
user=db_user
password=pass
UID=db_user
PWD=pass
dbHost=127.0.0.1
dbPort=3306
dbPort=3306
dbDriver={MySQL ODBC 8.0 ANSI Driver}
3 changes: 2 additions & 1 deletion test/resources/config_files/pyodbc/wrong_password.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ dbName=db
dbUsername=db_user
dbPassword=wrong
dbHost=127.0.0.1
dbPort=3306
dbPort=3306
dbDriver={MySQL ODBC 8.0 ANSI Driver}
6 changes: 5 additions & 1 deletion test/tests/common_tests/connection_params.robot
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Test Teardown Disconnect From Database
... missing basic params=OperationalError: (1045, "Access denied*
... invalid custom param=TypeError: __init__() got an unexpected keyword argument 'blah'
&{Errors pyodbc}
... missing basic params=OperationalError: (20002, b'DB-Lib error message 20002, severity 9*
... missing basic params=REGEXP: InterfaceError.*Data source name not found and no default driver specified.*
... invalid custom param=TypeError: connect() got an unexpected keyword argument 'blah'

&{Errors}
Expand All @@ -46,6 +46,7 @@ All basic params, no config file
... dbPassword=${DB_PASS}
... dbHost=${DB_HOST}
... dbPort=${DB_PORT}
... dbDriver=${DB_DRIVER}

Missing basic params are accepted, error from Python DB module
Run Keyword And Expect Error
Expand All @@ -59,6 +60,7 @@ Custom params as keyword args - valid
... dbName=${DB_NAME}
... dbHost=${DB_HOST}
... dbPort=${DB_PORT}
... dbDriver=${DB_DRIVER}
... user=${DB_USER}
... password=${DB_PASS}

Expand All @@ -72,6 +74,7 @@ Custom params as keyword args - invalid, error from Python DB module
... dbPort=${DB_PORT}
... dbUsername=${DB_USER}
... dbPassword=${DB_PASS}
... dbDriver=${DB_DRIVER}
... blah=blah

All basic params in config file
Expand Down Expand Up @@ -132,6 +135,7 @@ MSSQL / MySQL / PyODBC specific - charset as keyword argument
... dbPassword=${DB_PASS}
... dbHost=${DB_HOST}
... dbPort=${DB_PORT}
... dbDriver=${DB_DRIVER}
... dbCharset=LATIN1

MSSQL / PyODBC specific - charset in config file - invalid
Expand Down

0 comments on commit 946c259

Please sign in to comment.