frank: thuban/test test_load.py,1.41,1.42

cvs@intevation.de cvs at intevation.de
Wed Dec 15 10:44:36 CET 2004


Author: frank

Update of /thubanrepository/thuban/test
In directory doto:/tmp/cvs-serv21373/test

Modified Files:
	test_load.py 
Log Message:
(TestAltPath.checkSession): New, extended checks if session has been loaded 
	successfully. The check is called by the relevant tests after executing 
	load_session().


Index: test_load.py
===================================================================
RCS file: /thubanrepository/thuban/test/test_load.py,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- test_load.py	13 Dec 2004 17:51:11 -0000	1.41
+++ test_load.py	15 Dec 2004 09:44:34 -0000	1.42
@@ -1016,7 +1016,7 @@
     file_contents = '''\
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE session SYSTEM "thuban-1.1.dtd">
-<session xmlns="http://thuban.intevation.org/dtds/thuban-1.1-dev.dtd" title="Thuban sample session">
+<session xmlns="http://thuban.intevation.org/dtds/thuban-1.1-dev.dtd" title="AltPath Test session">
     <fileshapesource filetype="shapefile" id="D1108450956" filename="../../Data/iceland/political.shp"/>
     <fileshapesource filetype="shapefile" id="D1108900076" filename="../Data/iceland/roads-line.shp"/>
     <fileshapesource filetype="shapefile" id="D1108947244" filename="../../Data/iceland/cultural_landmark-point.shp"/>
@@ -1028,15 +1028,34 @@
 </session>
 '''
 
+    def checkSession(self, session):
+        """Check if session has been loaded successfully."""
+        
+        eq = self.assertEquals
+
+        map = session.Maps()[0]
+        layers = map.Layers()
+
+        eq("AltPath Test session", session.Title())
+        eq("not the iceland map", map.Title())
+        eq(3,len(layers))
+        eq("political",layers[0].Title())
+        eq("roads-line",layers[1].Title())
+        eq("something else",layers[2].Title())
+
     def test_01_single_path_error_fix(self):
         """Test single file path error fix."""
+        
+        eq = self.assertEquals
+        
         # The usual initial case
         s_cb = Shapefile_CallBack({
                     "search": [("../Data/iceland/roads-line.shp",0)], 
                     "check": [(None, None)]})
         self.session = load_session(self.filename(), 
                                     shapefile_callback =s_cb.s_cb)
-
+        self.checkSession(self.session)
+        
     def test_02_path_error_fix_from_list(self):
         """Test single file path error fix."""
         # This represents the usual case for "from_list" 
@@ -1046,6 +1065,7 @@
                })
         self.session = load_session(self.filename(), 
                                     shapefile_callback =s_cb.s_cb)
+        self.checkSession(self.session)
 
     def test_03_single_path_error_cancelled(self):
         """Test alternative path cancelled."""
@@ -1072,6 +1092,7 @@
                })
         self.session = load_session(self.filename(), 
                                     shapefile_callback =s_cb.s_cb)
+        self.checkSession(self.session)
 
     def test_06_path_error_fix_from_list_fails(self):
         """Test alternative path recovery from list."""





More information about the Thuban-devel mailing list

This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)