def test_build_ex_06(self): """Simple Capability List document """ cl = CapabilityList() cl.describedby = 'http://example.com/info_about_set1_of_resources.xml' cl.up = 'http://example.com/resourcesync_description.xml' cl.add_capability( uri='http://example.com/dataset1/resourcelist.xml', name='resourcelist' ) cl.add_capability( uri='http://example.com/dataset1/resourcedump.xml', name='resourcedump' ) cl.add_capability( uri='http://example.com/dataset1/changelist.xml', name='changelist' ) ex_xml = self._open_ex('resourcesync_ex_6').read() self._assert_xml_equal( cl.as_xml(), ex_xml )
def test_build_ex_13(self): """Capability List document with 4 entries""" cl = CapabilityList() cl.describedby = 'http://example.com/info_about_set1_of_resources.xml' cl.up = 'http://example.com/resourcesync_description.xml' cl.add_capability( capability=ResourceList( uri='http://example.com/dataset1/resourcelist.xml' ) ) cl.add_capability( capability=ResourceDump( uri='http://example.com/dataset1/resourcedump.xml' ) ) cl.add_capability( capability=ChangeList( uri='http://example.com/dataset1/changelist.xml' ) ) cl.add_capability( capability=ChangeDump( uri='http://example.com/dataset1/changedump.xml' ) ) ex_xml = self._open_ex('resourcesync_ex_13').read() self._assert_xml_equal( cl.as_xml(), ex_xml )
def get(self): """Implement GET for Capability List.""" capability_list = CapabilityList() capability_list.describedby = self.source.describedby_uri capability_list.up = self.source.source_description_uri capability_list.add_capability( uri=self.source.resource_list_builder.uri, name='resourcelist') if self.source.has_changememory: capability_list.add_capability( uri=self.source.changememory.base_uri, name='changelist') self.set_header("Content-Type", "application/xml") self.write(capability_list.as_xml())