Exemple #1
0
    def test_get_journal_by_jid(self):
        """
        Testando a função controllers.get_journal_by_jid() deve retornar um
        objeto ``Journal`` com o id=jid123.
        """
        journal = self._makeOne(attrib={'_id': 'jid123'})

        self.assertEqual(controllers.get_journal_by_jid('jid123').id,
                         journal.id)
Exemple #2
0
def journal_detail(journal_id):
    journal = controllers.get_journal_by_jid(journal_id)

    if not journal:
        abort(404, _(u'Periódico não encontrado'))

    context = {'journal': journal}

    return render_template("journal/detail.html", **context)
Exemple #3
0
    def test_get_journal_by_jid_with_some_params(self):
        """
        Testando a função controllers.get_journal_by_jid() deve retornar um
        objeto ``Journal`` com o id=jid123 e com is_public=false.
        """
        journal1 = self._makeOne(attrib={'_id': 'jid1', 'is_public': True})
        journal2 = self._makeOne(attrib={'_id': 'jid2', 'is_public': True})
        journal3 = self._makeOne(attrib={'_id': 'jid3', 'is_public': False})
        journal4 = self._makeOne(attrib={'_id': 'jid4', 'is_public': False})

        self.assertEqual(controllers.get_journal_by_jid('jid3',
                         is_public=False).id, journal3.id)
Exemple #4
0
def issue_grid(journal_id):
    journal = controllers.get_journal_by_jid(journal_id)

    if not journal:
        abort(404, _(u'Periódico não encontrado'))

    issues = controllers.get_issues_by_jid(journal_id)

    result_dict = OrderedDict()
    for issue in issues:
        key_year = str(issue.year)
        key_volume = str(issue.volume)
        result_dict.setdefault(key_year, OrderedDict())
        result_dict[key_year].setdefault(key_volume, []).append(issue)

    context = {
        'journal': journal,
        'result_dict': result_dict,
    }
    return render_template("issue/grid.html", **context)
Exemple #5
0
 def test_get_journal_by_jid_without_journal(self):
     """
     Testando controllers.get_journal_by_jid() sem journal, deve retornar
     None
     """
     self.assertIsNone(controllers.get_journal_by_jid('anyjid'))