Exemple #1
0
    def _localized_topic_keyword_in_url(self, topic: str, localized: str,
                                        keyword: str, url: str):
        topic = Topic(topic)
        localized_topic = LocalizedTopic(topic, self.user.learned_language,
                                         localized)
        localized_topic.keywords = keyword

        article = ArticleRule().article
        url = Url.find_or_create(self.db.session, url)
        article.url = url

        assert localized_topic.matches_article(article)
Exemple #2
0
    def testDownloadWithTopic(self):
        feed = RSSFeedRule().feed1
        topic = Topic("Spiegel")
        zeeguu_core.db.session.add(topic)
        zeeguu_core.db.session.commit()
        loc_topic = LocalizedTopic(topic, self.lan, "spiegelDE", "spiegel")
        zeeguu_core.db.session.add(loc_topic)
        zeeguu_core.db.session.commit()

        download_from_feed(feed, zeeguu_core.db.session, 3)

        article = feed.get_articles(limit=2)[0]

        assert (topic in article.topics)
 def test_add_topic(self):
     health = Topic("health")
     sports = Topic("sports")
     self.article1.add_topic(health)
     self.article1.add_topic(sports)
     assert len(self.article1.topics) == 2