Ejemplo n.º 1
0
    def test_parse(self):
        """
        Tohle je opravdu dummy test, jestli se z parseru dostane to co ma.
        Chce to jeste osetrovat a testovat jeho funkcionalitu.
        """
        parser = FeedParser()
        parser.parse('http://nwoo.org/rss.php')

        self.assertIsInstance(parser.feed_meta, FeedMeta)
        [self.assertIsInstance(article, Article) for article in parser.article_list]
Ejemplo n.º 2
0
Archivo: api.py Proyecto: hellth/bobrot
def get_parsed_articles():
    article_list = []
    for resource in Resource.objects.all():
        feed_parser = FeedParser()
        feed_parser.parse(resource.url)

        project_path = '/tmp/bobrot'


        for feed_article in feed_parser.article_list:
            article = ArticleParse(project_path, feed_article,
                feed_parser.feed_meta)

            article_list.append(article.get_api_article())

    return article_list
Ejemplo n.º 3
0
    def test_save_articles(self):
        feed_parser = FeedParser()
        feed_parser.parse('http://www.vysocina-news.cz/rss/')

        project_path = '/tmp/bobrot'

        for feed_article in feed_parser.article_list:
            article_parser = ArticleParse(project_path, feed_article,
                                          feed_parser.feed_meta)
            data = article_parser.call()

            article = Article()
            article.content = data

            self._import_data_to_model(article, feed_article)
            article.save()


        self.assertEquals(len(feed_parser.article_list), Article.objects.count())
Ejemplo n.º 4
0
    def test_save_articles(self):
        feed_parser = FeedParser()
        feed_parser.parse('http://www.vysocina-news.cz/rss/')

        project_path = '/tmp/bobrot'

        for feed_article in feed_parser.article_list:
            article_parser = ArticleParse(project_path, feed_article,
                                          feed_parser.feed_meta)
            data = article_parser.call()

            article = Article()
            article.content = data

            self._import_data_to_model(article, feed_article)
            article.save()

        self.assertEquals(len(feed_parser.article_list),
                          Article.objects.count())