Exemple #1
0
    def test_search_term_in_url(self):
        config = {'return_value': self.rss}

        with patch('feedparser.parse', **self.config) as mocked:
            nyaa.fetch_rss(1, "Sword Art Online")
            url = mocked.call_args[0][0]
            self.assertIn('page=rss',  url)
            self.assertIn('term=Sword+Art+Online',  url)
            self.assertIn('user=1', url)
            self.assertTrue(url.startswith("http://nyaa.eu"))
Exemple #2
0
 def test_search_term_unicode(self):
     config = {'return_value': self.rss}
     with patch('feedparser.parse', **self.config) as mocked:
         nyaa.fetch_rss(1,  u"「K」")
         url = mocked.call_args[0][0]
         self.assertIn(u'term=%E3%80%8CK%E3%80%8D',  url)
Exemple #3
0
 def test_fetch_rss(self):
     with patch('feedparser.parse', **self.config) as m:
         result = nyaa.fetch_rss(1)
         self.assertEquals(result, self.rss)
         self.assertIs(type(result['entries'][0]['title']), unicode)