Esempio n. 1
0
    def test_get_issues_by_iid_without_issue(self):
        """
        Testando controllers.get_issues_by_iid() sem issue, deve retornar None.
        """

        issues = controllers.get_issues_by_iid(['iid1', 'iid12', 'iid123'])

        self.assertEqual(issues, {})
Esempio n. 2
0
    def test_get_issues_by_iid_without_issue(self):
        """
        Testando controllers.get_issues_by_iid() sem issue, deve retornar None.
        """

        issues = controllers.get_issues_by_iid(['iid1', 'iid12', 'iid123'])

        self.assertEqual(issues, {})
Esempio n. 3
0
    def test_set_issue_is_public_bulk_without_iids(self):
        """
        Testando alterar o valor de um conjunto de journals, sem ids.
        """

        self._makeOne(attrib={'_id': '0ow9sms9ms', 'is_public': True})
        self._makeOne(attrib={'_id': '90k2ud90ds', 'is_public': True})
        self._makeOne(attrib={'_id': '98jd9dhydk', 'is_public': True})

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

        ids = ['0ow9sms9ms', '90k2ud90ds', '98jd9dhydk']

        issues = controllers.get_issues_by_iid(ids)

        for issue in issues.values():
            self.assertTrue(issue.is_public)
Esempio n. 4
0
    def test_set_issue_is_public_bulk(self):
        """
        Testando alterar o valor de um conjunto de issues.
        """

        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_issue_is_public_bulk(
            ['012ijs9y24', '2183ikos90', '9298wjso89'], is_public=False)

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

        issues = controllers.get_issues_by_iid(ids)

        for issue in issues.values():
            self.assertFalse(issue.is_public)
Esempio n. 5
0
    def test_set_issue_is_public_bulk_without_iids(self):
        """
        Testando alterar o valor de um conjunto de journals, sem ids.
        """

        self._make_one(attrib={'_id': '0ow9sms9ms', 'is_public': True})
        self._make_one(attrib={'_id': '90k2ud90ds', 'is_public': True})
        self._make_one(attrib={'_id': '98jd9dhydk', 'is_public': True})

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

        ids = ['0ow9sms9ms', '90k2ud90ds', '98jd9dhydk']

        issues = controllers.get_issues_by_iid(ids)

        for issue in issues.values():
            self.assertTrue(issue.is_public)
Esempio n. 6
0
    def test_set_issue_is_public_bulk(self):
        """
        Testando alterar o valor de um conjunto de issues.
        """

        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_issue_is_public_bulk(
            ['012ijs9y24', '2183ikos90', '9298wjso89'], is_public=False)

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

        issues = controllers.get_issues_by_iid(ids)

        for issue in issues.values():
            self.assertFalse(issue.is_public)
Esempio n. 7
0
    def test_set_issue_is_public_bulk_setting_reason(self):
        """
        Testando alterar o valor de um conjunto de issues com o motivo, param
        ``reason``.
        """

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

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

        controllers.set_issue_is_public_bulk(ids, is_public=False,
                                             reason='plágio')

        issues = controllers.get_issues_by_iid(ids)

        for issue in issues.values():
            self.assertEqual('plágio', issue.unpublish_reason)
Esempio n. 8
0
    def test_set_issue_is_public_bulk_setting_reason(self):
        """
        Testando alterar o valor de um conjunto de issues com o motivo, param
        ``reason``.
        """
        unpublish_reason = 'plágio'
        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})

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

        controllers.set_issue_is_public_bulk(ids, is_public=False,
                                             reason='plágio')

        issues = controllers.get_issues_by_iid(ids)

        for issue in issues.values():
            self.assertEqual(unpublish_reason, issue.unpublish_reason)
Esempio n. 9
0
    def test_get_issues_by_iid(self):
        """
        Testando a função controllers.get_issues_by_iid() deve retornar uma
        lista contendo objetos ``Issue``.
        """

        self._makeAny(items=5)

        self._makeOne(attrib={'_id': 'iid1'})
        self._makeOne(attrib={'_id': 'iid12'})
        self._makeOne(attrib={'_id': 'iid123'})

        self._makeAny(items=5)

        issues = controllers.get_issues_by_iid(['iid1', 'iid12', 'iid123'])

        expected = ['iid1', 'iid12', 'iid123']

        self.assertListEqual(sorted([issue for issue in issues.keys()]),
                             sorted(expected))
Esempio n. 10
0
    def test_get_issues_by_iid(self):
        """
        Testando a função controllers.get_issues_by_iid() deve retornar uma
        lista contendo objetos ``Issue``.
        """

        self._make_any(items=5)

        self._make_one(attrib={'_id': 'iid1'})
        self._make_one(attrib={'_id': 'iid12'})
        self._make_one(attrib={'_id': 'iid123'})

        self._make_any(items=5)

        issues = controllers.get_issues_by_iid(['iid1', 'iid12', 'iid123'])

        expected = ['iid1', 'iid12', 'iid123']

        self.assertListEqual(sorted([issue for issue in issues.keys()]),
                             sorted(expected))