[Zope3-checkins] CVS: Packages/ZConfig/tests - test_schema.py:1.1.2.14

Fred L. Drake, Jr. fred@zope.com
Fri, 13 Dec 2002 10:58:59 -0500


Update of /cvs-repository/Packages/ZConfig/tests
In directory cvs.zope.org:/tmp/cvs-serv3260

Modified Files:
      Tag: zconfig-schema-devel-branch
	test_schema.py 
Log Message:
test_load_sectiongroup():
    Add keys to the types in the group, so we can further test that
    everything is getting mapped properly.


=== Packages/ZConfig/tests/test_schema.py 1.1.2.13 => 1.1.2.14 ===
--- Packages/ZConfig/tests/test_schema.py:1.1.2.13	Fri Dec 13 10:45:21 2002
+++ Packages/ZConfig/tests/test_schema.py	Fri Dec 13 10:58:58 2002
@@ -214,8 +214,12 @@
         schema = self.load_schema_text(
             "<schema>"
             "  <sectiongroup name='group'>"
-            "    <sectiontype name='t1'/>"
-            "    <sectiontype name='t2'/>"
+            "    <sectiontype name='t1'>"
+            "      <key name='k1'><default>default1</default></key>"
+            "      </sectiontype>"
+            "    <sectiontype name='t2'>"
+            "      <key name='k2'><default>default2</default></key>"
+            "      </sectiontype>"
             "    </sectiongroup>"
             "  <section name='*' type='group' maxOccurs='2' attribute='g'/>"
             "</schema>")
@@ -233,14 +237,19 @@
         # try loading a config that relies on this schema
         conf = self.load_config_text(schema,
                                      "<t1/>\n"
-                                     "<t1>\n </t1>\n"
+                                     "<t1>\n k1 value1\n </t1>\n"
                                      "<t2/>\n"
-                                     "<t2>\n </t2>\n")
-        self.assertEqual(len(conf.g), 4)
+                                     "<t2>\n k2 value2\n </t2>\n")
+        eq = self.assertEqual
+        eq(len(conf.g), 4)
         self.assert_(conf.g[0].__type__ is t1)
         self.assert_(conf.g[1].__type__ is t1)
         self.assert_(conf.g[2].__type__ is t2)
         self.assert_(conf.g[3].__type__ is t2)
+        eq(conf.g[0].k1, "default1")
+        eq(conf.g[1].k1, "value1")
+        eq(conf.g[2].k2, "default2")
+        eq(conf.g[3].k2, "value2")
 
     # utilities