Beispiel #1
0
 def get(self):
     """Implement GET for Source Description."""
     source_description = SourceDescription()
     source_description.describedby = self.source.describedby_uri
     source_description.add_capability_list(self.source.capability_list_uri)
     self.set_header("Content-Type", "application/xml")
     self.write(source_description.as_xml())
Beispiel #2
0
 def get(self):
     """Implement GET for Source Description."""
     source_description = SourceDescription()
     source_description.describedby = self.source.describedby_uri
     source_description.add_capability_list(self.source.capability_list_uri)
     self.set_header("Content-Type", "application/xml")
     self.write(source_description.as_xml())
Beispiel #3
0
 def test02_one_caplist(self):
     rsd = SourceDescription()
     rsd.describedby = "http://example.org/about"
     self.assertEqual( len(rsd), 0 )
     rsd.md_at = None
     rsd.add_capability_list("http://example.org/ds1/cl.xml")
     self.assertEqual( len(rsd), 1 )
     self.assertEqual( rsd.as_xml(), '<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:rs="http://www.openarchives.org/rs/terms/"><rs:ln href="http://example.org/about" rel="describedby" /><rs:md capability="description" /><url><loc>http://example.org/ds1/cl.xml</loc><rs:md capability="capabilitylist" /></url></urlset>' )
 def test01_empty(self):
     rsd = SourceDescription()
     rsd.describedby = "http://example.org/about"
     self.assertEqual(len(rsd), 0)
     rsd.md_at = None
     self.assertEqual(
         rsd.as_xml(),
         '<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:rs="http://www.openarchives.org/rs/terms/"><rs:ln href="http://example.org/about" rel="describedby" /><rs:md capability="description" /></urlset>'
     )
Beispiel #5
0
 def test_build_ex_07(self):
     """A Source Description document """
     sd = SourceDescription()
     sd.describedby = 'http://example.com/info-about-source.xml'
     r = Resource( uri='http://example.com/dataset1/capabilitylist.xml',
                   capability='capabilitylist' )
     r.link_set( rel='describedby',
                 href='http://example.com/info_about_set1_of_resources.xml' )
     sd.add( r )
     ex_xml = self._open_ex('resourcesync_ex_7').read()
     self._assert_xml_equal( sd.as_xml(), ex_xml )
Beispiel #6
0
 def test_build_ex_12(self):
     """Source Description document with describedby links"""
     sd = SourceDescription()
     sd.describedby = 'http://example.com/info_about_source.xml'
     cl1 = CapabilityList( uri='http://example.com/capabilitylist1.xml' )
     cl1.describedby = 'http://example.com/info_about_set1_of_resources.xml'
     sd.add_capability_list( cl1 )
     cl2 = CapabilityList( uri='http://example.com/capabilitylist2.xml' )
     cl2.describedby = 'http://example.com/info_about_set2_of_resources.xml'
     sd.add_capability_list( cl2 )
     cl3 = CapabilityList( uri='http://example.com/capabilitylist3.xml' )
     cl3.describedby = 'http://example.com/info_about_set3_of_resources.xml'
     sd.add_capability_list( cl3 )
     ex_xml = self._open_ex('resourcesync_ex_12').read()
     self._assert_xml_equal( sd.as_xml(), ex_xml )
Beispiel #7
0
 def test01_empty(self):
     rsd = SourceDescription()
     rsd.describedby = "http://example.org/about"
     self.assertEqual( len(rsd), 0 )
     rsd.md_at = None
     self.assertEqual( rsd.as_xml(), '<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:rs="http://www.openarchives.org/rs/terms/"><rs:ln href="http://example.org/about" rel="describedby" /><rs:md capability="description" /></urlset>' )