1 |
# Copyright (c) 2002, 2003 by Intevation GmbH |
# Copyright (c) 2002, 2003, 2004 by Intevation GmbH |
2 |
# Authors: |
# Authors: |
3 |
# Bernhard Herzog <[email protected]> |
# Bernhard Herzog <[email protected]> |
4 |
# |
# |
16 |
Maintenance of the test cases: |
Maintenance of the test cases: |
17 |
|
|
18 |
When during a development period the file format is changed with respect |
When during a development period the file format is changed with respect |
19 |
to the last released version for the first, the tests here should be |
to the last released version for the first time, the tests here should |
20 |
copied to the version specific test file. The round-trip tests which |
be copied to the version specific test file. The round-trip tests which |
21 |
save the session again and compare the XML files should not be copied |
save the session again and compare the XML files should not be copied |
22 |
over as they only make sense here to make sure th that the files checked |
over as they only make sense here to make sure th that the files checked |
23 |
here are actually ones that may have been written by the current thuban |
here are actually ones that may have been written by the current thuban |
89 |
self.session = None |
self.session = None |
90 |
|
|
91 |
|
|
92 |
dtd = "http://thuban.intevation.org/dtds/thuban-1.0.0.dtd" |
dtd = "http://thuban.intevation.org/dtds/thuban-1.1-dev.dtd" |
93 |
thubanids = [((dtd, n), (None, "id")) for n in |
thubanids = [((dtd, n), (None, "id")) for n in |
94 |
["fileshapesource", "filetable", "jointable", |
["fileshapesource", "filetable", "jointable", |
95 |
"derivedshapesource"]] |
"derivedshapesource"]] |
185 |
# want to test whether the loading code handles that correctly. |
# want to test whether the loading code handles that correctly. |
186 |
file_contents = '''\ |
file_contents = '''\ |
187 |
<?xml version="1.0" encoding="UTF-8"?> |
<?xml version="1.0" encoding="UTF-8"?> |
188 |
<!DOCTYPE session SYSTEM "thuban-1.0.dtd"> |
<!DOCTYPE session SYSTEM "thuban-1.1.dtd"> |
189 |
<session xmlns="http://thuban.intevation.org/dtds/thuban-1.0.0.dtd" |
<session xmlns="http://thuban.intevation.org/dtds/thuban-1.1-dev.dtd" |
190 |
title="Stra\xc3\x9fen & Landmarken"> |
title="Stra\xc3\x9fen & Landmarken"> |
191 |
<fileshapesource filetype="shapefile" id="D1" |
<fileshapesource filetype="shapefile" id="D1" |
192 |
filename="../../Data/iceland/political.shp"/> |
filename="../../Data/iceland/political.shp"/> |
277 |
|
|
278 |
file_contents = '''\ |
file_contents = '''\ |
279 |
<?xml version="1.0" encoding="UTF-8"?> |
<?xml version="1.0" encoding="UTF-8"?> |
280 |
<!DOCTYPE session SYSTEM "thuban-1.0.dtd"> |
<!DOCTYPE session SYSTEM "thuban-1.1.dtd"> |
281 |
<session xmlns="http://thuban.intevation.org/dtds/thuban-1.0.0.dtd" |
<session xmlns="http://thuban.intevation.org/dtds/thuban-1.1-dev.dtd" |
282 |
title="Non ASCII column name test"> |
title="Non ASCII column name test"> |
283 |
<fileshapesource filetype="shapefile" id="D1" |
<fileshapesource filetype="shapefile" id="D1" |
284 |
filename="TestNonAsciiColumnName.shp"/> |
filename="TestNonAsciiColumnName.shp"/> |
354 |
|
|
355 |
file_contents = '''\ |
file_contents = '''\ |
356 |
<?xml version="1.0" encoding="UTF-8"?> |
<?xml version="1.0" encoding="UTF-8"?> |
357 |
<!DOCTYPE session SYSTEM "thuban-1.0.dtd"> |
<!DOCTYPE session SYSTEM "thuban-1.1.dtd"> |
358 |
<session xmlns="http://thuban.intevation.org/dtds/thuban-1.0.0.dtd" |
<session xmlns="http://thuban.intevation.org/dtds/thuban-1.1-dev.dtd" |
359 |
title="single map&layer"> |
title="single map&layer"> |
360 |
<fileshapesource filetype="shapefile" id="D1" |
<fileshapesource filetype="shapefile" id="D1" |
361 |
filename="../../Data/iceland/political.shp"/> |
filename="../../Data/iceland/political.shp"/> |
392 |
|
|
393 |
file_contents = '''\ |
file_contents = '''\ |
394 |
<?xml version="1.0" encoding="UTF-8"?> |
<?xml version="1.0" encoding="UTF-8"?> |
395 |
<!DOCTYPE session SYSTEM "thuban-1.0.dtd"> |
<!DOCTYPE session SYSTEM "thuban-1.1.dtd"> |
396 |
<session xmlns="http://thuban.intevation.org/dtds/thuban-1.0.0.dtd" |
<session xmlns="http://thuban.intevation.org/dtds/thuban-1.1-dev.dtd" |
397 |
title="single map&layer"> |
title="single map&layer"> |
398 |
<fileshapesource filetype="shapefile" id="D138389860" |
<fileshapesource filetype="shapefile" id="D138389860" |
399 |
filename="../../Data/iceland/political.shp"/> |
filename="../../Data/iceland/political.shp"/> |
484 |
|
|
485 |
file_contents = '''\ |
file_contents = '''\ |
486 |
<?xml version="1.0" encoding="UTF-8"?> |
<?xml version="1.0" encoding="UTF-8"?> |
487 |
<!DOCTYPE session SYSTEM "thuban-1.0.dtd"> |
<!DOCTYPE session SYSTEM "thuban-1.1.dtd"> |
488 |
<session xmlns="http://thuban.intevation.org/dtds/thuban-1.0.0.dtd" |
<session xmlns="http://thuban.intevation.org/dtds/thuban-1.1-dev.dtd" |
489 |
title="single map&layer"> |
title="single map&layer"> |
490 |
<fileshapesource filetype="shapefile" id="D1" |
<fileshapesource filetype="shapefile" id="D1" |
491 |
filename="../../Data/iceland/political.shp"/> |
filename="../../Data/iceland/political.shp"/> |
532 |
|
|
533 |
file_contents = '''\ |
file_contents = '''\ |
534 |
<?xml version="1.0" encoding="UTF-8"?> |
<?xml version="1.0" encoding="UTF-8"?> |
535 |
<!DOCTYPE session SYSTEM "thuban-1.0.dtd"> |
<!DOCTYPE session SYSTEM "thuban-1.1.dtd"> |
536 |
<session xmlns="http://thuban.intevation.org/dtds/thuban-1.0.0.dtd" |
<session xmlns="http://thuban.intevation.org/dtds/thuban-1.1-dev.dtd" |
537 |
title="single map&layer"> |
title="single map&layer"> |
538 |
<fileshapesource filetype="shapefile" id="D2" |
<fileshapesource filetype="shapefile" id="D2" |
539 |
filename="../../Data/iceland/roads-line.shp"/> |
filename="../../Data/iceland/roads-line.shp"/> |
610 |
|
|
611 |
file_contents = '''\ |
file_contents = '''\ |
612 |
<?xml version="1.0" encoding="UTF-8"?> |
<?xml version="1.0" encoding="UTF-8"?> |
613 |
<!DOCTYPE session SYSTEM "thuban-1.0.dtd"> |
<!DOCTYPE session SYSTEM "thuban-1.1.dtd"> |
614 |
<session xmlns="http://thuban.intevation.org/dtds/thuban-1.0.0.dtd" |
<session xmlns="http://thuban.intevation.org/dtds/thuban-1.1-dev.dtd" |
615 |
title="single map&layer"> |
title="single map&layer"> |
616 |
<map title="Test Map"> |
<map title="Test Map"> |
617 |
<rasterlayer visible="false" filename="../../Data/iceland/island.tif" |
<rasterlayer visible="false" filename="../../Data/iceland/island.tif" |
644 |
class TestJoinedTable(LoadSessionTest): |
class TestJoinedTable(LoadSessionTest): |
645 |
|
|
646 |
file_contents = '''<?xml version="1.0" encoding="UTF-8"?> |
file_contents = '''<?xml version="1.0" encoding="UTF-8"?> |
647 |
<!DOCTYPE session SYSTEM "thuban-1.0.dtd"> |
<!DOCTYPE session SYSTEM "thuban-1.1.dtd"> |
648 |
<session xmlns="http://thuban.intevation.org/dtds/thuban-1.0.0.dtd" title="A Joined Table session"> |
<session xmlns="http://thuban.intevation.org/dtds/thuban-1.1-dev.dtd" title="A Joined Table session"> |
649 |
<fileshapesource filetype="shapefile" id="D137227612" |
<fileshapesource filetype="shapefile" id="D137227612" |
650 |
filename="../../Data/iceland/roads-line.shp"/> |
filename="../../Data/iceland/roads-line.shp"/> |
651 |
<filetable filetype="DBF" filename="load_joinedtable.dbf" id="D136171140" |
<filetable filetype="DBF" filename="load_joinedtable.dbf" id="D136171140" |
695 |
# test whether they're supported correctly. |
# test whether they're supported correctly. |
696 |
|
|
697 |
file_contents = '''<?xml version="1.0" encoding="UTF-8"?> |
file_contents = '''<?xml version="1.0" encoding="UTF-8"?> |
698 |
<!DOCTYPE session SYSTEM "thuban-1.0.dtd"> |
<!DOCTYPE session SYSTEM "thuban-1.1.dtd"> |
699 |
<session xmlns="http://thuban.intevation.org/dtds/thuban-1.0.0.dtd" title="Thuban sample session"> |
<session xmlns="http://thuban.intevation.org/dtds/thuban-1.1-dev.dtd" title="Thuban sample session"> |
700 |
<fileshapesource filetype="shapefile" id="D145265052" |
<fileshapesource filetype="shapefile" id="D145265052" |
701 |
filename="../../Data/iceland/political.shp"/> |
filename="../../Data/iceland/political.shp"/> |
702 |
<fileshapesource filetype="shapefile" id="D145412868" |
<fileshapesource filetype="shapefile" id="D145412868" |
752 |
class TestPostGISLayer(LoadSessionTest): |
class TestPostGISLayer(LoadSessionTest): |
753 |
|
|
754 |
file_contents = '''<?xml version="1.0" encoding="UTF-8"?> |
file_contents = '''<?xml version="1.0" encoding="UTF-8"?> |
755 |
<!DOCTYPE session SYSTEM "thuban-1.0.dtd"> |
<!DOCTYPE session SYSTEM "thuban-1.1.dtd"> |
756 |
<session xmlns="http://thuban.intevation.org/dtds/thuban-1.0.0.dtd" |
<session xmlns="http://thuban.intevation.org/dtds/thuban-1.1-dev.dtd" |
757 |
title="unnamed session"> |
title="unnamed session"> |
758 |
<dbconnection port="%(port)s" host="%(host)s" user="%(user)s" |
<dbconnection port="%(port)s" host="%(host)s" user="%(user)s" |
759 |
dbtype="postgis" id="D142684948" dbname="%(dbname)s"/> |
dbtype="postgis" id="D142684948" dbname="%(dbname)s"/> |
760 |
<dbshapesource tablename="landmarks" id="D143149420" dbconn="D142684948"/> |
<dbshapesource id="D143149420" dbconn="D142684948" |
761 |
|
tablename="landmarks_point_id" id_column="point_id" |
762 |
|
geometry_column="the_geom" /> |
763 |
<map title="unnamed map"> |
<map title="unnamed map"> |
764 |
<layer shapestore="D143149420" visible="true" stroke="#000000" |
<layer shapestore="D143149420" visible="true" stroke="#000000" |
765 |
title="landmarks" stroke_width="1" fill="None"/> |
title="landmarks" stroke_width="1" fill="None"/> |
803 |
class TestPostGISLayerPassword(LoadSessionTest): |
class TestPostGISLayerPassword(LoadSessionTest): |
804 |
|
|
805 |
file_contents = '''<?xml version="1.0" encoding="UTF-8"?> |
file_contents = '''<?xml version="1.0" encoding="UTF-8"?> |
806 |
<!DOCTYPE session SYSTEM "thuban-1.0.dtd"> |
<!DOCTYPE session SYSTEM "thuban-1.1.dtd"> |
807 |
<session xmlns="http://thuban.intevation.org/dtds/thuban-1.0.0.dtd" |
<session xmlns="http://thuban.intevation.org/dtds/thuban-1.1-dev.dtd" |
808 |
title="unnamed session"> |
title="unnamed session"> |
809 |
<dbconnection port="%(port)s" host="%(host)s" user="%(user)s" |
<dbconnection port="%(port)s" host="%(host)s" user="%(user)s" |
810 |
dbtype="postgis" id="D142684948" dbname="%(dbname)s"/> |
dbtype="postgis" id="D142684948" dbname="%(dbname)s"/> |
898 |
|
|
899 |
file_contents = '''\ |
file_contents = '''\ |
900 |
<?xml version="1.0" encoding="UTF-8"?> |
<?xml version="1.0" encoding="UTF-8"?> |
901 |
<!DOCTYPE session SYSTEM "thuban-1.0.dtd"> |
<!DOCTYPE session SYSTEM "thuban-1.1.dtd"> |
902 |
<session xmlns="http://thuban.intevation.org/dtds/thuban-1.0.0.dtd" |
<session xmlns="http://thuban.intevation.org/dtds/thuban-1.1-dev.dtd" |
903 |
title="single map&layer"> |
title="single map&layer"> |
904 |
<fileshapesource id="D1" filename="../../Data/iceland/political.shp"/> |
<fileshapesource id="D1" filename="../../Data/iceland/political.shp"/> |
905 |
<map title="Test Map"> |
<map title="Test Map"> |
926 |
# LoadError really was about the missing attribute |
# LoadError really was about the missing attribute |
927 |
self.assertEquals(str(value), |
self.assertEquals(str(value), |
928 |
"Element " |
"Element " |
929 |
"(u'http://thuban.intevation.org/dtds/thuban-1.0.0.dtd'," |
"(u'http://thuban.intevation.org/dtds/thuban-1.1-dev.dtd'," |
930 |
" u'fileshapesource') requires an attribute 'filetype'") |
" u'fileshapesource') requires an attribute 'filetype'") |
931 |
else: |
else: |
932 |
self.fail("Missing filetype attribute doesn't raise LoadError") |
self.fail("Missing filetype attribute doesn't raise LoadError") |