[Greater-commits] r292 - in trunk/GREAT-ER-DB/impl/postgresql/test: . data
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Tue Jun 28 15:58:31 CEST 2011
Author: aheinecke
Date: 2011-06-28 15:58:30 +0200 (Tue, 28 Jun 2011)
New Revision: 292
Added:
trunk/GREAT-ER-DB/impl/postgresql/test/data/
trunk/GREAT-ER-DB/impl/postgresql/test/data/itterrivernet.dbf
Modified:
trunk/GREAT-ER-DB/impl/postgresql/test/test_pg_p_bin_obj.py
Log:
Enable tests for bin_obj
Added: trunk/GREAT-ER-DB/impl/postgresql/test/data/itterrivernet.dbf
===================================================================
(Binary files differ)
Property changes on: trunk/GREAT-ER-DB/impl/postgresql/test/data/itterrivernet.dbf
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
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-06-28 10:49:06 UTC (rev 291)
+++ trunk/GREAT-ER-DB/impl/postgresql/test/test_pg_p_bin_obj.py 2011-06-28 13:58:30 UTC (rev 292)
@@ -44,76 +44,66 @@
def setUp(self):
set_api_interface("_dagreater_pg")
self.server = postgressupport.get_test_server()
- self.connection_target = self.server.known_dbs["static_db"].get_connection_target()
- print self.connection_target
- da_db_connect("anonym_greater", "", self.connection_target)
+ self.connection_target = self.server.known_dbs["static_db"].get_connection_target()
+ da_db_connect("anonym_greater", "", self.connection_target)
-
# PLEASE INSERT LOCAL FILENAMES OF BINARY DATA TO GO THROUGH THESE TESTS !
+ def test_0_insert_bin_obj(self):
+ filename = os.path.abspath(os.path.join("data", "itterrivernet.dbf"))
+ filesize = os.stat(filename)[ST_SIZE]
+ f = open(filename, 'r')
+ buffer = 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':buffer,'file_size':filesize,'cre_date':'30-11-2003','mod_date':'29-11-2003','write':'2','remark':'remark_string here!'})
+ self.res = da_insert_bin_obj(bin_obj_record)
+ da_db_commit()
+ self.assertEquals(self.res,None)
+ def test_1_load_bin_obj(self):
+ filename = "itterrivernet.dbf"
+ filepath = os.path.abspath("data")
+ filesize = os.stat(os.path.join(filepath, filename))[ST_SIZE]
+ 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':buffer,'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)
+ self.res = da_load_bin_obj(bin_obj_record, "N", filepath, filename)
+ da_db_commit()
+ self.assertEquals(self.res,None)
-# def test_0_insert_bin_obj(self):
-# !HERE!
-# filename = ""
-# !HERE!
-# filesize = os.stat('')[ST_SIZE]
-# !HERE!
-# f = open('', 'r')
-# buffer = 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':buffer,'file_size':filesize,'cre_date':'30-11-2003','mod_date':'29-11-2003','write':'2','remark':'remark_string here!'})
-# self.res = da_insert_bin_obj(bin_obj_record)
-# da_db_commit()
-# self.assertEquals(self.res,None)
+ def test_2_get_bin_obj(self):
+ self.res = da_get_bin_obj(1,"catchment",201,"Y")
+ self.assertNotEquals(len(self.res[0].file_obj),0)
+ self.res = da_get_bin_obj(2,"CATCHMENT",202,"Y")
+ self.assertNotEquals(len(self.res[0].file_obj),0)
+ self.res = da_get_bin_obj(2,"CATCHMENT",202,"N")
+ self.assertEquals(self.res[0].file_obj,None)
+ self.assertNotEquals(len(self.res),0)
+ self.res = da_get_bin_obj(2,'CATCHMENT',203,"Y")
+ self.assertNotEquals(len(self.res[0].file_obj),0)
+ self.assertNotEquals(len(self.res),0)
+ self.res = da_get_bin_obj(1,"catchment",205,"Y")
+ self.assertEquals(len(self.res),0)
-# def test_1_load_bin_obj(self):
-# !HERE!
-# filename = ""
-# !HERE!
-# filepath = ""
-# !HERE!
-# filesize = os.stat('')[ST_SIZE]
- # 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':buffer,'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)
-# self.res = da_load_bin_obj(bin_obj_record, "N", filepath, filename)
-# da_db_commit()
-# self.assertEquals(self.res,None)
+ def test_3_update_bin_obj(self):
+ self.res = da_get_bin_obj(1,"catchment",201,"Y")
+ print self.res[0].name
+ self.res[0].name = "irgendeinName"
+ print self.res[0].name
+ self.res = da_update_bin_obj(self.res[0])
+ self.res = da_get_bin_obj(1,"catchment",201,"Y")
+ print self.res[0].name
+ self.assertNotEquals(len(self.res),0)
-# def test_2_get_bin_obj(self):
-# self.res = da_get_bin_obj(1,"catchment",201,"Y")
-# self.assertNotEquals(len(self.res[0].file_obj),0)
-# self.res = da_get_bin_obj(2,"CATCHMENT",202,"Y")
-# self.assertNotEquals(len(self.res[0].file_obj),0)
-# self.res = da_get_bin_obj(2,"CATCHMENT",202,"N")
-# self.assertEquals(self.res[0].file_obj,None)
-# self.assertNotEquals(len(self.res),0)
-# self.res = da_get_bin_obj(2,'CATCHMENT',203,"Y")
-# self.assertNotEquals(len(self.res[0].file_obj),0)
-# self.assertNotEquals(len(self.res),0)
-# self.res = da_get_bin_obj(1,"catchment",205,"Y")
-# self.assertEquals(len(self.res),0)
+ def test_4_delete_bin_obj(self):
+ self.res = da_get_bin_obj(1,"catchment",201,"Y")
+ self.assertNotEquals(len(self.res),0)
+ self.res = da_delete_bin_obj(201)
+ da_db_commit()
+ self.res = da_get_bin_obj(1,"catchment",201,"Y")
+ self.assertEquals(len(self.res),0)
-# def test_3_update_bin_obj(self):
-# self.res = da_get_bin_obj(1,"catchment",201,"Y")
-# print self.res[0].name
-# self.res[0].name = "irgendeinName"
-# print self.res[0].name
-# self.res = da_update_bin_obj(self.res[0])
-# self.res = da_get_bin_obj(1,"catchment",201,"Y")
-# print self.res[0].name
-# self.assertNotEquals(len(self.res),0)
-
-# def test_4_delete_bin_obj(self):
-# self.res = da_get_bin_obj(1,"catchment",201,"Y")
-# self.assertNotEquals(len(self.res),0)
-# self.res = da_delete_bin_obj(201)
-# da_db_commit()
-# self.res = da_get_bin_obj(1,"catchment",201,"Y")
-# self.assertEquals(len(self.res),0)
-
def tearDown(self):
- da_db_disconnect()
-
+ da_db_disconnect()
+
if __name__ == "__main__":
support.run_tests()
More information about the Greater-commits
mailing list