[Greater-commits] r336 - trunk/GREAT-ER-DB/impl/postgresql/test
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Thu Jun 30 15:09:53 CEST 2011
Author: bricks
Date: 2011-06-30 15:09:52 +0200 (Thu, 30 Jun 2011)
New Revision: 336
Modified:
trunk/GREAT-ER-DB/impl/postgresql/test/test_pg_d_connect.py
Log:
Always catch only the correct exception not all
in this case AssertionError from our self.fail command was also catched
Modified: trunk/GREAT-ER-DB/impl/postgresql/test/test_pg_d_connect.py
===================================================================
--- trunk/GREAT-ER-DB/impl/postgresql/test/test_pg_d_connect.py 2011-06-30 13:09:23 UTC (rev 335)
+++ trunk/GREAT-ER-DB/impl/postgresql/test/test_pg_d_connect.py 2011-06-30 13:09:52 UTC (rev 336)
@@ -54,17 +54,22 @@
da_db_connect("AnoNym", "123", self.connection_target)
def test_db_greater(self):
- da_db_connect("GREATER200", "", self.connection_target)
+ try:
+ da_db_connect("GREATER200", "", self.connection_target)
+ self.fail("It should not be possible to connect with an empty "\
+ "password")
+ except RuntimeError:
+ pass
def test_db_user_und_greater(self):
da_db_connect("anonym_greater", "hallo", self.connection_target)
def test_db_users(self):
try:
- db_db_connect("anonym", "", self.connection_target)
+ da_db_connect("anonym", "", self.connection_target)
self.fail("It should not be possible to connect with an empty"\
" password")
- except:
+ except RuntimeError:
pass
# creater new testuser
@@ -92,23 +97,26 @@
da_db_connect("john_doe", "Hallo", self.connection_target);
self.fail("It should not be possible to connect user with "\
"mixedcase password")
- except:
+ except RuntimeError:
pass
try:
da_db_connect("john_doe", "HALLO", self.connection_target);
self.fail("It should not be possible to connect user with "\
"uppercase password")
- except:
+ except RuntimeError:
pass
try:
da_db_connect("john doe", "hallo", self.connection_target);
self.fail("It should not be possible to connect username with "\
"spaces")
- except:
+ except RuntimeError as e:
pass
+ da_db_connect("john_doe", "hallo", self.connection_target)
+ da_db_disconnect()
+
def test_db_disconnect(self):
# test several disconnects in a row
# there should be no error
More information about the Greater-commits
mailing list