Changeset: d2dab5c03cd2 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d2dab5c03cd2 Modified Files: sql/test/Users/Tests/changePasswordUser.SQL.py Branch: mtest Log Message:
convert tests for changePasswordUser diffs (89 lines): diff --git a/sql/test/Users/Tests/changePasswordUser.SQL.py b/sql/test/Users/Tests/changePasswordUser.SQL.py --- a/sql/test/Users/Tests/changePasswordUser.SQL.py +++ b/sql/test/Users/Tests/changePasswordUser.SQL.py @@ -3,44 +3,54 @@ # Assess that a user can change its own password. ### -import os, sys -try: - from MonetDBtesting import process -except ImportError: - import process +from MonetDBtesting.sqltest import SQLTestCase -def sql_test_client(user, passwd, input): - with process.client(lang="sql", user=user, passwd=passwd, communicate=True, - stdin=process.PIPE, stdout=process.PIPE, stderr=process.PIPE, - input=input, port=int(os.getenv("MAPIPORT"))) as c: - c.communicate() +with SQLTestCase() as tc: + tc.connect(username="april", password="april") + tc.execute("ALTER USER april WITH UNENCRYPTED PASSWORD 'april2';").assertSucceeded() + tc.execute("select 'password april';").assertSucceeded() + tc.execute("select 'password april2'; ALTER USER SET UNENCRYPTED PASSWORD 'april5' USING OLD PASSWORD 'april3'; ALTER USER SET UNENCRYPTED PASSWORD 'april' USING OLD PASSWORD 'april2';").assertSucceeded() + tc.execute("select 'password april2 (wrong!!!)';").assertSucceeded() + tc.execute("select 'password change successfully';").assertSucceeded() -sql_test_client('monetdb', 'monetdb', input="""\ -ALTER USER april WITH UNENCRYPTED PASSWORD 'april2'; -""") +# import os, sys +# try: +# from MonetDBtesting import process +# except ImportError: +# import process -# try to log in with old password -sql_test_client('april', 'april', input="""\ -select 'password april'; -""") +# def sql_test_SqSqSqlllclient(user, passwd, input): +# with process.client(lang="sql", user=user, passwd=passwd, communicate=True, +# stdin=process.PIPE, stdout=process.PIPE, stderr=process.PIPE, +# input=input, port=int(os.getenv("MAPIPORT"))) as c: +# c.communicate() + +# sql_test_client('monetdb', 'monetdb', input="""\ +# ALTER USER april WITH UNENCRYPTED PASSWORD 'april2'; +# """) -# try to log in with new password -sql_test_client('april', 'april2', input="""\ -select 'password april2'; -ALTER USER SET UNENCRYPTED PASSWORD 'april5' USING OLD PASSWORD 'april3'; -ALTER USER SET UNENCRYPTED PASSWORD 'april' USING OLD PASSWORD 'april2'; -""") +# # try to log in with old password +# sql_test_client('april', 'april', input="""\ +# select 'password april'; +# """) -# try to log in with old password -sql_test_client('april', 'april2', input="""\ -select 'password april2 (wrong!!!)'; -""") +# # try to log in with new password +# sql_test_client('april', 'april2', input="""\ +# select 'password april2'; +# ALTER USER SET UNENCRYPTED PASSWORD 'april5' USING OLD PASSWORD 'april3'; +# ALTER USER SET UNENCRYPTED PASSWORD 'april' USING OLD PASSWORD 'april2'; +# """) + +# # try to log in with old password +# sql_test_client('april', 'april2', input="""\ +# select 'password april2 (wrong!!!)'; +# """) -# try to log in with the new password -sql_test_client('april', 'april', input="""\ -select 'password change successfully'; -""") +# # try to log in with the new password +# sql_test_client('april', 'april', input="""\ +# select 'password change successfully'; +# """) _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list