[Greater-commits] r320 - trunk/GREAT-ER-DB/impl/postgresql/test
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Thu Jun 30 11:43:36 CEST 2011
Author: bricks
Date: 2011-06-30 11:43:36 +0200 (Thu, 30 Jun 2011)
New Revision: 320
Modified:
trunk/GREAT-ER-DB/impl/postgresql/test/test_pg_l_user.py
Log:
Add tests for da_set_password
Modified: trunk/GREAT-ER-DB/impl/postgresql/test/test_pg_l_user.py
===================================================================
--- trunk/GREAT-ER-DB/impl/postgresql/test/test_pg_l_user.py 2011-06-30 09:43:33 UTC (rev 319)
+++ trunk/GREAT-ER-DB/impl/postgresql/test/test_pg_l_user.py 2011-06-30 09:43:36 UTC (rev 320)
@@ -36,6 +36,7 @@
from GreaterDB.interface import da_insert_user
from GreaterDB.interface import da_update_user
from GreaterDB.interface import da_delete_user
+from GreaterDB.interface import da_set_password
from GreaterDB.interface import DA_S_user
@@ -44,6 +45,7 @@
def setUp(self):
set_api_interface("_dagreater_pg")
self.server = postgressupport.get_test_server()
+ self.server.require_authentication(True)
self.connection_target = self.server.known_dbs["static_db"].get_connection_target()
da_db_connect("anonym", "123", self.connection_target)
# import time
@@ -57,9 +59,9 @@
'status':'VALID',
'remark':'Standard User!'})
res = da_insert_user(user_record, "hallo")
+ self.assertEquals(res, None)
da_db_commit()
- self.assertEquals(res, None)
res = da_get_user('john_doe')
self.assertEquals(len(res), 1);
# we always get the user_id in uppercase
@@ -211,6 +213,39 @@
res = da_get_user('john_doe')
self.assertEquals(len(res), 0)
+ def test_4_set_password(self):
+ user_record = DA_S_user({'user_id':'john_doe',
+ 'group_id':101,
+ 'cre_date':'30-11-2003',
+ 'mod_date':'29-11-2003',
+ 'status':'VALID',
+ 'remark':'Standard User!'})
+ res = da_insert_user(user_record, "hallo")
+ da_db_commit()
+ res = da_get_user('john_doe')
+ self.assertEquals(len(res), 1)
+ self.assertEquals(res[0].user_id, "JOHN_DOE");
+
+ da_db_disconnect()
+ da_db_connect("john_doe", "hallo", self.connection_target)
+ res = da_get_user('john_doe')
+ self.assertEquals(len(res), 1)
+ self.assertEquals(res[0].user_id, "JOHN_DOE");
+ da_set_password("john_doe", "hallo123")
+ da_db_commit()
+ da_db_disconnect()
+
+ da_db_connect("john_doe", "hallo123", self.connection_target)
+ da_set_password("john_doe", "HALLO123")
+ da_db_commit()
+ da_db_disconnect()
+ try:
+ da_db_connect("john_doe", "hallo123", self.connection_target)
+ self.fail("User john_doe should not be able to connect with"\
+ " uppercase password");
+ except:
+ pass
+
def tearDown(self):
da_db_disconnect()
More information about the Greater-commits
mailing list