Changeset: 36f6002c42e3 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=36f6002c42e3
Modified Files:
sql/test/Users/Tests/grantMonetdbToRegularUser.Bug-3771.SQL.py
Branch: mtest
Log Message:
convert tests for grantMonetdbToRegularUser
diffs (100 lines):
diff --git a/sql/test/Users/Tests/grantMonetdbToRegularUser.Bug-3771.SQL.py
b/sql/test/Users/Tests/grantMonetdbToRegularUser.Bug-3771.SQL.py
--- a/sql/test/Users/Tests/grantMonetdbToRegularUser.Bug-3771.SQL.py
+++ b/sql/test/Users/Tests/grantMonetdbToRegularUser.Bug-3771.SQL.py
@@ -3,44 +3,65 @@
# Check that by assuming the monetdb role the user has complete privileges
(e.g. select, create, drop).
###
+from MonetDBtesting.sqltest import SQLTestCase
-import os, sys
-try:
- from MonetDBtesting import process
-except ImportError:
- import process
+with SQLTestCase() as tc:
+ tc.connect(username="monetdb", password="monetdb")
+ tc.execute("CREATE USER user_with_many_rights with password
'ThisIsAS3m1S3cur3P4ssw0rd' name 'user gets monetdb rights' schema sys;")
+ tc.execute("CREATE SCHEMA
a_brand_new_schema_with_a_longer_name_than_usual;").assertSucceeded()
+ tc.execute("CREATE table
a_brand_new_schema_with_a_longer_name_than_usual.testTable(v1 int, v2
int);").assertSucceeded()
+ tc.execute("GRANT sysadmin to user_with_many_rights;").assertSucceeded()
-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()
-
-sql_test_client('monetdb', 'monetdb', input="""\
-CREATE USER user_with_many_rights with password 'ThisIsAS3m1S3cur3P4ssw0rd'
name 'user gets monetdb rights' schema sys;
+ tc.connect(username="user_with_many_rights",
password="ThisIsAS3m1S3cur3P4ssw0rd")
+ tc.execute("""
+ set schema a_brand_new_schema_with_a_longer_name_than_usual;
+ set role sysadmin;
+ DROP TABLE testTable;
+ CREATE TABLE testTable(v1 INT);
+ ALTER TABLE testTable ADD COLUMN v2 INT;
+ SELECT * FROM testTable;
+ INSERT INTO testTable VALUES (3, 3);
+ UPDATE testTable SET v1 = 2 WHERE v2 = 7;
+ DELETE FROM testTable WHERE v1 = 2;
+ """).assertSucceeded()
-CREATE SCHEMA a_brand_new_schema_with_a_longer_name_than_usual;
-
-CREATE table a_brand_new_schema_with_a_longer_name_than_usual.testTable(v1
int, v2 int);
+# import os, sys
+# try:
+# from MonetDBtesting import process
+# except ImportError:
+# import process
--- Grant delete rights.
-GRANT sysadmin to user_with_many_rights;
+# 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()
-""")
+# sql_test_client('monetdb', 'monetdb', input="""\
+# CREATE USER user_with_many_rights with password 'ThisIsAS3m1S3cur3P4ssw0rd'
name 'user gets monetdb rights' schema sys;
-sql_test_client('user_with_many_rights', 'ThisIsAS3m1S3cur3P4ssw0rd',
input="""\
--- Check delete.
-set schema a_brand_new_schema_with_a_longer_name_than_usual;
-set role sysadmin;
+# CREATE SCHEMA a_brand_new_schema_with_a_longer_name_than_usual;
+
+# CREATE table a_brand_new_schema_with_a_longer_name_than_usual.testTable(v1
int, v2 int);
+
+# -- Grant delete rights.
+# GRANT sysadmin to user_with_many_rights;
+
+# """)
-DROP TABLE testTable;
-CREATE TABLE testTable(v1 INT);
-ALTER TABLE testTable ADD COLUMN v2 INT;
+# sql_test_client('user_with_many_rights', 'ThisIsAS3m1S3cur3P4ssw0rd',
input="""\
+# -- Check delete.
+# set schema a_brand_new_schema_with_a_longer_name_than_usual;
+# set role sysadmin;
+
+# DROP TABLE testTable;
+# CREATE TABLE testTable(v1 INT);
+# ALTER TABLE testTable ADD COLUMN v2 INT;
-SELECT * FROM testTable;
-INSERT INTO testTable VALUES (3, 3);
-UPDATE testTable SET v1 = 2 WHERE v2 = 7;
-DELETE FROM testTable WHERE v1 = 2;
-""")
+# SELECT * FROM testTable;
+# INSERT INTO testTable VALUES (3, 3);
+# UPDATE testTable SET v1 = 2 WHERE v2 = 7;
+# DELETE FROM testTable WHERE v1 = 2;
+# """)
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list