Changeset: 7a495782f974 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7a495782f974
Modified Files:
sql/test/Users/Tests/grantMonetdbToSchemaOwner.Bug-3771.SQL.py
sql/test/Users/Tests/grantPrivilegesNonDefaultRole.Bug-3365.SQL.py
Branch: mtest
Log Message:
convert tests for grantMonetdbToSchemaOwner and grantPrivilegesNonDefaultRole
diffs (116 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
@@ -6,23 +6,21 @@
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);")
+ tc.execute("CREATE USER owner with password 'ThisIsAS3m1S3cur3P4ssw0rd'
name 'user gets monetdb rights' schema sys;").assertSucceeded()
+ tc.execute("CREATE SCHEMA schemaForOwner AUTHORIZATION
owner;").assertSucceeded()
+ tc.execute("CREATE table schemaForOwner.testTable(v1 int, v2
int);").assertSucceeded()
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("""
+ set schema schemaForOwner;
+ 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()
# import os, sys
# try:
diff --git a/sql/test/Users/Tests/grantPrivilegesNonDefaultRole.Bug-3365.SQL.py
b/sql/test/Users/Tests/grantPrivilegesNonDefaultRole.Bug-3365.SQL.py
--- a/sql/test/Users/Tests/grantPrivilegesNonDefaultRole.Bug-3365.SQL.py
+++ b/sql/test/Users/Tests/grantPrivilegesNonDefaultRole.Bug-3365.SQL.py
@@ -3,31 +3,54 @@
# 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 role hr_role;
+ create schema hr authorization hr_role;
+ create user blake with password 'password' name 'Blake' schema "hr";
+ create user clark with password 'password' name 'Clark' schema "hr";
+ grant hr_role to blake;
+ """).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()
+ tc.connect(username="blake", password="password")
+ tc.execute("""
+ set role hr_role;
+ create table employees (id bigint,name varchar(20));
+ grant select on employees to clark from current_role;
+ """).assertSucceeded()
+
+ tc.execute("""
+ set role hr_role;
+ grant select on employees to clark;
+ """).assertFailed()
-sql_test_client('monetdb', 'monetdb', input="""\
-create role hr_role;
-create schema hr authorization hr_role;
-create user blake with password 'password' name 'Blake' schema "hr";
-create user clark with password 'password' name 'Clark' schema "hr";
-grant hr_role to blake;
-""")
+# import os, sys
+# try:
+# from MonetDBtesting import process
+# except ImportError:
+# import process
+
+# 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('blake', 'password', input="""\
-set role hr_role;
-create table employees (id bigint,name varchar(20));
-grant select on employees to clark;
-grant select on employees to clark from current_role;
-""")
+# sql_test_client('monetdb', 'monetdb', input="""\
+# create role hr_role;
+# create schema hr authorization hr_role;
+# create user blake with password 'password' name 'Blake' schema "hr";
+# create user clark with password 'password' name 'Clark' schema "hr";
+# grant hr_role to blake;
+# """)
+# sql_test_client('blake', 'password', input="""\
+# set role hr_role;
+# create table employees (id bigint,name varchar(20));
+# grant select on employees to clark;
+# grant select on employees to clark from current_role;
+# """)
+
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list