Exemplo n.º 1
0
Arquivo: tests.py Projeto: kilatev/rn
class RSSToolsTestCase(TestCase):

    def setUp(self):
        self.rss_tools = RSSTools('ru')

    def test_get_feed_url(self):
        url = self.rss_tools.get_feed_url()
        self.assertTrue(url)
        self.assertEquals(url, 'https://www.riga.lv/rss/ru/news/')

    def test_get_parsed_results(self):
        self.assertTrue(self.rss_tools.get_parsed_results())

    def test_parsed_to_model(self):
        pre_count = Item.objects.count()
        parsed = self.rss_tools.get_parsed_results()
        res = self.rss_tools.parsed_to_model(parsed)
        post_count = Item.objects.count()
        self.assertNotEqual(pre_count, post_count)

    def test_create_channel(self):
        parsed = self.rss_tools.get_parsed_results()
        channel = self.rss_tools.create_channel(parsed)
        self.assertTrue(channel)
Exemplo n.º 2
0
Arquivo: api.py Projeto: kilatev/rn
 def list(self):
     tools = RSSTools('ru')
     parsed = tools.get_parsed_results()
     tools.parsed_to_model(parsed)
     return Item.objects.all()
Exemplo n.º 3
0
Arquivo: tests.py Projeto: kilatev/rn
 def setUp(self):
     self.rss_tools = RSSTools('ru')