[Greater-commits] r357 - trunk/GREAT-ER-DB/impl/postgresql/test
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Wed Jul 6 17:10:49 CEST 2011
Author: bricks
Date: 2011-07-06 17:10:48 +0200 (Wed, 06 Jul 2011)
New Revision: 357
Modified:
trunk/GREAT-ER-DB/impl/postgresql/test/test_pg_p_bin_obj.py
Log:
Update testcase to check for new string or None check
Modified: trunk/GREAT-ER-DB/impl/postgresql/test/test_pg_p_bin_obj.py
===================================================================
--- trunk/GREAT-ER-DB/impl/postgresql/test/test_pg_p_bin_obj.py 2011-07-06 14:39:13 UTC (rev 356)
+++ trunk/GREAT-ER-DB/impl/postgresql/test/test_pg_p_bin_obj.py 2011-07-06 15:10:48 UTC (rev 357)
@@ -62,9 +62,41 @@
filename = "itterrivernet.dbf"
filepath = os.path.abspath("data")
filesize = os.stat(os.path.join(filepath, filename))[ST_SIZE]
- f = open(filename, 'rb')
- buf = f.read()
- bin_obj_record = DA_S_bin_obj({'bin_obj_id':0,'object_id':2,'name':filename,'user_id':'anonym','privs':6,'obj_type':'CATCHMENT','obj_sub_type':'RIVERNET','file_type':'DBF','file_obj':buf,'file_size':filesize,'cre_date':'30-11-2003','mod_date':'29-11-2003','write':'2','remark':'remark_string here!'})
+ bin_obj_record = DA_S_bin_obj({'bin_obj_id':0,
+ 'object_id':2,
+ 'name':filename,
+ 'user_id':'anonym',
+ 'privs':6,
+ 'obj_type':'CATCHMENT',
+ 'obj_sub_type':'RIVERNET',
+ 'file_type':'DBF',
+ 'file_obj':type(""),
+ 'file_size':filesize,
+ 'cre_date':'30-11-2003',
+ 'mod_date':'29-11-2003',
+ 'write':'2',
+ 'remark':'remark_string here!'
+ })
+ try:
+ self.res = da_load_bin_obj(bin_obj_record, "Y", filepath, filename)
+ self.fail("file_obj must be either a string or None")
+ except TypeError:
+ pass
+ bin_obj_record = DA_S_bin_obj({'bin_obj_id':0,
+ 'object_id':2,
+ 'name':filename,
+ 'user_id':'anonym',
+ 'privs':6,
+ 'obj_type':'CATCHMENT',
+ 'obj_sub_type':'RIVERNET',
+ 'file_type':'DBF',
+ 'file_obj':None,
+ 'file_size':filesize,
+ 'cre_date':'30-11-2003',
+ 'mod_date':'29-11-2003',
+ 'write':'2',
+ 'remark':'remark_string here!'
+ })
self.res = da_load_bin_obj(bin_obj_record, "Y", filepath, filename)
da_db_commit()
self.assertEquals(self.res,None)
More information about the Greater-commits
mailing list