示例#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.assertIsNone(articles)
示例#2
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.itervalues():
            self.assertFalse(article.is_public)
示例#3
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 = [u'aid1', u'aid12', u'aid123']

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