[Greater-commits] r309 - trunk/GREAT-ER-DB/impl/postgresql/test
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Wed Jun 29 16:51:54 CEST 2011
Author: bricks
Date: 2011-06-29 16:51:54 +0200 (Wed, 29 Jun 2011)
New Revision: 309
Modified:
trunk/GREAT-ER-DB/impl/postgresql/test/test_pg_l_user.py
Log:
Add some additional delete user tests and add comments
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-29 14:45:50 UTC (rev 308)
+++ trunk/GREAT-ER-DB/impl/postgresql/test/test_pg_l_user.py 2011-06-29 14:51:54 UTC (rev 309)
@@ -58,11 +58,13 @@
'remark':'Standard User!'})
res = da_insert_user(user_record, "hallo")
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
self.assertEquals(res[0].user_id, 'JOHN_DOE');
+
res = da_delete_user('john_doe')
da_db_commit()
@@ -72,11 +74,14 @@
res = da_get_user('anonym')
self.assertEquals(len(res), 1)
self.assertEquals(res[0].user_id, "ANONYM")
+
res = da_get_user('icjicjab')
self.assertEquals(len(res), 0)
+
res = da_get_user("");
self.assertEquals(len(res), 3);
self.assertEquals(res[0].user_id, "ANONYM")
+
user_record = DA_S_user({'user_id':'john_doe',
'group_id':101,
'cre_date':'30-11-2003',
@@ -84,11 +89,13 @@
'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");
self.assertEquals(res[0].group_id, 101);
+ # creation and modified date is set by db
self.assertEquals(res[0].cre_date, today);
self.assertEquals(res[0].mod_date, today);
self.assertEquals(res[0].status, "VALID");
@@ -133,6 +140,8 @@
'remark':'Standard User!'})
res = da_insert_user(user_record, "hallo")
da_db_commit()
+
+ # update user
user = da_get_user('john_doe')
self.assertEquals(len(user), 1)
user[0].status = 'INVALID'
@@ -146,10 +155,12 @@
self.assertEquals(res[0].mod_date, today);
self.assertEquals(res[0].status, "INVALID");
self.assertEquals(res[0].remark, "Standard User!");
+
res = da_delete_user('john_doe')
da_db_commit()
def test_3_delete_user(self):
+ # test deletion of user with lowercase letters
user_record = DA_S_user({'user_id':'john_doe',
'group_id':101,
'cre_date':'30-11-2003',
@@ -160,14 +171,46 @@
da_db_commit()
res = da_get_user('john_doe')
self.assertEquals(len(res), 1)
+ self.assertEquals(res[0].user_id, "JOHN_DOE");
+ res = da_delete_user('john_doe')
+ da_db_commit()
res = da_get_user('john_doe')
+ self.assertEquals(len(res), 0)
+
+ # test deletion of user with uppercase letters
+ 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");
- res = da_delete_user('john_doe')
+ res = da_delete_user('JOHN_DOE')
da_db_commit()
res = da_get_user('john_doe')
self.assertEquals(len(res), 0)
+ # test deletion of user with mixedcase letters
+ 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");
+ res = da_delete_user('JOHN_doe')
+ da_db_commit()
+ res = da_get_user('john_doe')
+ self.assertEquals(len(res), 0)
+
def tearDown(self):
da_db_disconnect()
More information about the Greater-commits
mailing list