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