[Greater-commits] r334 - trunk/GREAT-ER-DB/impl/postgresql/test

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Jun 30 15:08:30 CEST 2011


Author: bricks
Date: 2011-06-30 15:08:30 +0200 (Thu, 30 Jun 2011)
New Revision: 334

Modified:
   trunk/GREAT-ER-DB/impl/postgresql/test/postgressupport.py
Log:
By default require authentication when getting a new postgres server
Raise a RuntimeException if a user couldn't be creater with createuser method


Modified: trunk/GREAT-ER-DB/impl/postgresql/test/postgressupport.py
===================================================================
--- trunk/GREAT-ER-DB/impl/postgresql/test/postgressupport.py	2011-06-30 13:07:57 UTC (rev 333)
+++ trunk/GREAT-ER-DB/impl/postgresql/test/postgressupport.py	2011-06-30 13:08:30 UTC (rev 334)
@@ -337,10 +337,12 @@
 
     def create_user(self, username, password):
         """Create user username with password in the database"""
-        self.execute_sql("template1", "admin",
-                         "CREATE USER %s PASSWORD '%s';" % (username,password))
+        rows = self.execute_sql("template1", "admin",
+                                "CREATE USER %s PASSWORD '%s';" % (username,password))
         if username != "anonym_greater":
-            self.execute_sql("template1", "admin", "ALTER USER %s CREATEUSER" % username)
+            rows = self.execute_sql("template1", "admin", "ALTER USER %s CREATEUSER" % username)
+        if not rows:
+            raise RuntimeError("Could not create user '%s'" % username)
 
     def alter_user(self, username, password):
         """Change the user username's password in the database"""
@@ -469,6 +471,7 @@
         db.execute_sql_file("PostgreSQL/create_system.sql", "create_system.log")
         db.execute_sql_file("PostgreSQL/update_objects.sql", "update_objects.log")
         db.execute_sql_file("PostgreSQL/inserts.sql", "insert_data.log")
+        _postgres_server.require_authentication()
 
     return _postgres_server
 



More information about the Greater-commits mailing list