Beispiel #1
0
    def test_get_articles_by_aid_without_article(self):
        """
        Testando controllers.get_articles_by_aid() sem article, deve retornar
        None.
        """

        articles = controllers.get_articles_by_aid(['aid1', 'aid12', 'aid123'])

        self.assertEqual(articles, {})
Beispiel #2
0
    def test_get_articles_by_aid_without_article(self):
        """
        Testando controllers.get_articles_by_aid() sem article, deve retornar
        None.
        """

        articles = controllers.get_articles_by_aid(['aid1', 'aid12', 'aid123'])

        self.assertEqual(articles, {})
Beispiel #3
0
 def rebuild_html(self, ids):
     try:
         articles = controllers.get_articles_by_aid(ids)
         count = 0
         for article in articles.itervalues():
             rebuild_article_xml(article)
             count += 1
         flash(_(u'Artigo(s) reconstruido com sucesso!!'))
     except Exception, ex:
         flash(_(u'Ocorreu um erro tentando reconstruir o(s) artigo(s)!!. Erro: %(ex)s',
                 ex=str(ex)),
               'error')
Beispiel #4
0
    def test_set_article_is_public_bulk(self):
        """
        Testando alterar o valor de um conjunto de article
        """

        self._makeOne(attrib={'_id': '012ijs9y24', 'is_public': True})
        self._makeOne(attrib={'_id': '2183ikos90', 'is_public': True})
        self._makeOne(attrib={'_id': '9298wjso89', 'is_public': True})

        controllers.set_article_is_public_bulk(
            ['012ijs9y24', '2183ikos90', '9298wjso89'], is_public=False)

        ids = ['012ijs9y24', '2183ikos90', '9298wjso89']

        articles = controllers.get_articles_by_aid(ids)

        for article in articles.values():
            self.assertFalse(article.is_public)
Beispiel #5
0
    def test_set_article_is_public_bulk(self):
        """
        Testando alterar o valor de um conjunto de article
        """

        self._make_one(attrib={'_id': '012ijs9y24', 'is_public': True})
        self._make_one(attrib={'_id': '2183ikos90', 'is_public': True})
        self._make_one(attrib={'_id': '9298wjso89', 'is_public': True})

        controllers.set_article_is_public_bulk(
            ['012ijs9y24', '2183ikos90', '9298wjso89'], is_public=False)

        ids = ['012ijs9y24', '2183ikos90', '9298wjso89']

        articles = controllers.get_articles_by_aid(ids)

        for article in articles.values():
            self.assertFalse(article.is_public)
Beispiel #6
0
    def test_set_article_is_public_bulk_without_aids(self):
        """
        Testando alterar o valor de um conjunto de journals sem iids, deve
        retorna um ValueError.
        """

        self._makeOne(attrib={'_id': '9ms9kos9js', 'is_public': True})
        self._makeOne(attrib={'_id': 'lksnsh8snk', 'is_public': True})
        self._makeOne(attrib={'_id': '7153gj6ysb', 'is_public': True})

        self.assertRaises(ValueError,
                          controllers.set_article_is_public_bulk, [], is_public=False)

        ids = ['9ms9kos9js', 'lksnsh8snk', '7153gj6ysb']

        articles = controllers.get_articles_by_aid(ids)

        for article in articles.values():
            self.assertTrue(article.is_public)
Beispiel #7
0
    def test_set_article_is_public_bulk_without_aids(self):
        """
        Testando alterar o valor de um conjunto de journals sem iids, deve
        retorna um ValueError.
        """

        self._make_one(attrib={'_id': '9ms9kos9js', 'is_public': True})
        self._make_one(attrib={'_id': 'lksnsh8snk', 'is_public': True})
        self._make_one(attrib={'_id': '7153gj6ysb', 'is_public': True})

        self.assertRaises(ValueError,
                          controllers.set_article_is_public_bulk, [], is_public=False)

        ids = ['9ms9kos9js', 'lksnsh8snk', '7153gj6ysb']

        articles = controllers.get_articles_by_aid(ids)

        for article in articles.values():
            self.assertTrue(article.is_public)
Beispiel #8
0
    def test_get_articles_by_aid(self):
        """
        Testando a função controllers.get_articles_by_aid() deve retornar uma
        lista contendo objetos ``Article`` .
        """

        self._makeAny(items=5)

        self._makeOne(attrib={'_id': 'aid1'})
        self._makeOne(attrib={'_id': 'aid12'})
        self._makeOne(attrib={'_id': 'aid123'})

        self._makeAny(items=5)

        articles = controllers.get_articles_by_aid(['aid1', 'aid12', 'aid123'])

        expected = ['aid1', 'aid12', 'aid123']

        self.assertListEqual(sorted([article for article in articles.keys()]),
                             sorted(expected))
Beispiel #9
0
    def test_get_articles_by_aid(self):
        """
        Testando a função controllers.get_articles_by_aid() deve retornar uma
        lista contendo objetos ``Article`` .
        """

        self._make_any(items=5)

        self._make_one(attrib={'_id': 'aid1'})
        self._make_one(attrib={'_id': 'aid12'})
        self._make_one(attrib={'_id': 'aid123'})

        self._make_any(items=5)

        articles = controllers.get_articles_by_aid(['aid1', 'aid12', 'aid123'])

        expected = ['aid1', 'aid12', 'aid123']

        self.assertListEqual(sorted([article for article in articles.keys()]),
                             sorted(expected))