Beispiel #1
0
 def test_WordPress_link_manager(self):
     # http://www.wasab.dk/morten/blog/archives/2006/10/22/wp-venus
     opml2config('''<outline type="link"
                             xmlUrl="http://example.com/feed.xml"
                             text="sample feed"/>''', self.config)
     self.assertEqual('sample feed',
                      self.config.get("http://example.com/feed.xml", 'name'))
Beispiel #2
0
 def test_illformed_xml_after(self):
     opml2config('''<outline type="rss"
                             xmlUrl="http://example.com/feed.xml"
                             text="sample feed"/>
                    <bad stuff after>''', self.config)
     self.assertEqual('sample feed',
                      self.config.get("http://example.com/feed.xml", 'name'))
Beispiel #3
0
 def test_missing_text(self):
     opml2config(
         '''<outline type="rss"
                             xmlUrl="http://example.com/feed.xml"
                             />''', self.config)
     self.assertFalse(
         self.config.has_section("http://example.com/feed.xml"))
Beispiel #4
0
 def test_blank_text_with_title(self):
     opml2config('''<outline type="rss"
                             xmlUrl="http://example.com/feed.xml"
                             text=""
                             title="sample feed"/>''', self.config)
     self.assertEqual('sample feed',
        self.config.get("http://example.com/feed.xml", 'name'))
Beispiel #5
0
 def test_illformed_xml_after(self):
     opml2config('''<outline type="rss"
                             xmlUrl="http://example.com/feed.xml"
                             text="sample feed"/>
                    <bad stuff after>''', self.config)
     self.assertEqual('sample feed',
        self.config.get("http://example.com/feed.xml", 'name'))
Beispiel #6
0
 def test_blank_text_with_title(self):
     opml2config('''<outline type="rss"
                             xmlUrl="http://example.com/feed.xml"
                             text=""
                             title="sample feed"/>''', self.config)
     self.assertEqual('sample feed',
                      self.config.get("http://example.com/feed.xml", 'name'))
Beispiel #7
0
 def test_wrong_type(self):
     opml2config(
         '''<outline type="other"
                             xmlUrl="http://example.com/feed.xml"
                             text="sample feed"/>''', self.config)
     self.assertFalse(
         self.config.has_section("http://example.com/feed.xml"))
Beispiel #8
0
 def test_text_utf8(self):
     opml2config('''<outline type="rss"
                             xmlUrl="http://example.com/feed.xml"
                             text="Se\xc3\xb1or Frog\xe2\x80\x99s"/>''',
                 self.config)
     self.assertEqual('Se\xc3\xb1or Frog\xe2\x80\x99s',
                      self.config.get("http://example.com/feed.xml", 'name'))
Beispiel #9
0
 def test_wrong_element(self):
     opml2config(
         '''<feed    type="rss"
                             xmlUrl="http://example.com/feed.xml"
                             text="sample feed"/>''', self.config)
     self.assertFalse(
         self.config.has_section("http://example.com/feed.xml"))
Beispiel #10
0
 def test_blank_text_no_title(self):
     opml2config(
         '''<outline type="rss"
                             xmlUrl="http://example.com/feed.xml"
                             text=""/>''', self.config)
     self.assertFalse(
         self.config.has_section("http://example.com/feed.xml"))
Beispiel #11
0
 def test_text_utf8(self):
     opml2config('''<outline type="rss"
                             xmlUrl="http://example.com/feed.xml"
                             text="Se\xc3\xb1or Frog\xe2\x80\x99s"/>''',
                 self.config)
     self.assertEqual('Se\xc3\xb1or Frog\xe2\x80\x99s',
        self.config.get("http://example.com/feed.xml", 'name'))
Beispiel #12
0
 def test_WordPress_link_manager(self):
     # http://www.wasab.dk/morten/blog/archives/2006/10/22/wp-venus
     opml2config('''<outline type="link"
                             xmlUrl="http://example.com/feed.xml"
                             text="sample feed"/>''', self.config)
     self.assertEqual('sample feed',
        self.config.get("http://example.com/feed.xml", 'name'))
Beispiel #13
0
 def test_type_atom(self):
     opml2config(
         '''<outline type="atom"
                             xmlUrl="http://example.com/feed.xml"
                             text="sample feed"/>''', self.config)
     self.assertEqual(
         'sample feed',
         self.config.get("http://example.com/feed.xml", 'name'))
Beispiel #14
0
 def test_title_attribute(self):
     opml2config(
         '''<outline type="rss"
                             xmlUrl="http://example.com/feed.xml"
                             title="sample feed"/>''', self.config)
     self.assertEqual(
         'sample feed',
         self.config.get("http://example.com/feed.xml", 'name'))
Beispiel #15
0
 def test_xmlurl_wrong_case(self):
     opml2config(
         '''<outline type="rss"
                             xmlurl="http://example.com/feed.xml"
                             text="sample feed"/>''', self.config)
     self.assertEqual(
         'sample feed',
         self.config.get("http://example.com/feed.xml", 'name'))
Beispiel #16
0
 def test_text_double_escaped(self):
     opml2config(
         '''<outline type="rss"
                             xmlUrl="http://example.com/feed.xml"
                             text="Se&amp;ntilde;or Frog&amp;rsquo;s"/>''',
         self.config)
     self.assertEqual(
         'Se\xc3\xb1or Frog\xe2\x80\x99s',
         self.config.get("http://example.com/feed.xml", 'name'))
Beispiel #17
0
        def data2config(data, cached_config):
                if content_type(list).find('opml')>=0:
                    opml.opml2config(data, cached_config)
                elif content_type(list).find('foaf')>=0:
                    foaf.foaf2config(data, cached_config)
                else:
                    from planet import shell
                    import StringIO
                    cached_config.readfp(StringIO.StringIO(shell.run(
                        content_type(list), data.getvalue(), mode="filter")))

                if cached_config.sections() in [[], [list]]: 
                    raise Exception
Beispiel #18
0
        def data2config(data, cached_config):
            if content_type(list).find('opml')>=0:
                opml.opml2config(data, cached_config)
            elif content_type(list).find('foaf')>=0:
                foaf.foaf2config(data, cached_config)
            elif content_type(list).find('csv')>=0:
                csv_config.csv2config(data, cached_config)
            elif content_type(list).find('config')>=0:
                cached_config.readfp(data)
            else:
                from planet import shell
                import StringIO
                cached_config.readfp(StringIO.StringIO(shell.run(
                    content_type(list), data.getvalue(), mode="filter")))

            if cached_config.sections() in [[], [list]]: 
                raise Exception
Beispiel #19
0
 def test_blank_xmlUrl(self):
     opml2config('''<outline type="rss"
                             xmlUrl=""
                             text="sample feed"/>''', self.config)
     self.assertFalse(self.config.has_section(""))
Beispiel #20
0
 def test_xmlurl_wrong_case(self):
     opml2config('''<outline type="rss"
                             xmlurl="http://example.com/feed.xml"
                             text="sample feed"/>''', self.config)
     self.assertEqual('sample feed',
        self.config.get("http://example.com/feed.xml", 'name'))
Beispiel #21
0
 def test_missing_xmlUrl(self):
     opml2config('''<outline type="rss"
                             text="sample feed"/>''', self.config)
     self.assertFalse(self.config.has_section("http://example.com/feed.xml"))
Beispiel #22
0
 def test_wrong_type(self):
     opml2config('''<outline type="other"
                             xmlUrl="http://example.com/feed.xml"
                             text="sample feed"/>''', self.config)
     self.assertFalse(self.config.has_section("http://example.com/feed.xml"))
Beispiel #23
0
 def test_blank_xmlUrl(self):
     opml2config(
         '''<outline type="rss"
                             xmlUrl=""
                             text="sample feed"/>''', self.config)
     self.assertFalse(self.config.has_section(""))
Beispiel #24
0
 def test_type_atom(self):
     opml2config('''<outline type="atom"
                             xmlUrl="http://example.com/feed.xml"
                             text="sample feed"/>''', self.config)
     self.assertEqual('sample feed',
        self.config.get("http://example.com/feed.xml", 'name'))
Beispiel #25
0
 def test_title_attribute(self):
     opml2config('''<outline type="rss"
                             xmlUrl="http://example.com/feed.xml"
                             title="sample feed"/>''', self.config)
     self.assertEqual('sample feed',
        self.config.get("http://example.com/feed.xml", 'name'))
Beispiel #26
0
 def test_wrong_element(self):
     opml2config('''<feed    type="rss"
                             xmlUrl="http://example.com/feed.xml"
                             text="sample feed"/>''', self.config)
     self.assertFalse(self.config.has_section("http://example.com/feed.xml"))
Beispiel #27
0
 def test_text_double_escaped(self):
     opml2config('''<outline type="rss"
                             xmlUrl="http://example.com/feed.xml"
                             text="Se&amp;ntilde;or Frog&amp;rsquo;s"/>''', self.config)
     self.assertEqual('Se\xc3\xb1or Frog\xe2\x80\x99s',
        self.config.get("http://example.com/feed.xml", 'name'))
Beispiel #28
0
 def test_blank_text_blank_title(self):
     opml2config('''<outline type="rss"
                             xmlUrl="http://example.com/feed.xml"
                             text=""
                             title=""/>''', self.config)
     self.assertFalse(self.config.has_section("http://example.com/feed.xml"))