[Greater-commits] r382 - trunk/GREAT-ER-DB/impl/postgresql/test
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Fri Jul 8 15:20:53 CEST 2011
Author: bricks
Date: 2011-07-08 15:20:52 +0200 (Fri, 08 Jul 2011)
New Revision: 382
Modified:
trunk/GREAT-ER-DB/impl/postgresql/test/postgressupport.py
Log:
Create greater_standard_role and set every new user to be a part of that role
Modified: trunk/GREAT-ER-DB/impl/postgresql/test/postgressupport.py
===================================================================
--- trunk/GREAT-ER-DB/impl/postgresql/test/postgressupport.py 2011-07-08 13:20:45 UTC (rev 381)
+++ trunk/GREAT-ER-DB/impl/postgresql/test/postgressupport.py 2011-07-08 13:20:52 UTC (rev 382)
@@ -168,9 +168,11 @@
self.alter_user(self.admin_name, self.admin_password)
self.create_role("anon_group")
- self.create_user(self.user_name, "123")
- self.create_user(self.another_user_name, self.another_user_password)
- self.create_user("GREATER200", "")
+ self.create_role("greater_standard_role")
+ self.create_user(self.user_name, "123", "greater_standard_role")
+ self.create_user(self.another_user_name, self.another_user_password,
+ "greater_standard_role")
+ self.create_user("GREATER200", "", "greater_standard_role")
def wait_for_postmaster(self):
"""Return when the database server is running
@@ -335,10 +337,14 @@
"""Create role rolename"""
self.execute_sql("template1", "admin", "CREATE ROLE %s" % rolename)
- def create_user(self, username, password):
+ def create_user(self, username, password, group=None):
"""Create user username with password in the database"""
+ in_role = ""
+ if group:
+ in_role = " IN ROLE %s" % group
rows = self.execute_sql("template1", "admin",
- "CREATE USER %s PASSWORD '%s';" % (username,password))
+ "CREATE USER %s PASSWORD '%s'%s;" %
+ (username, password, in_role))
if username != "anonym_greater":
rows = self.execute_sql("template1", "admin", "ALTER USER %s CREATEUSER" % username)
if not rows:
More information about the Greater-commits
mailing list