def test_ext_journal_catch_request_get_exception(self, mk_logger_error, mk_request_get): mk_request_get.side_effect = request.HTTPGetError result = journal.ext_journal("1234-5678") mk_logger_error.assert_called_once_with( "Journal nao encontrado: scl: 1234-5678") self.assertIsNone(result)
def test_ext_journal(self, mk_request_get): mk_request_get.return_value.json.return_value = [SAMPLES_JOURNAL] result = journal.ext_journal("1234-5678") mk_request_get.assert_called_once_with( ANY, params={"collection": ANY, "issn": "1234-5678"} ) self.assertEqual(result.title, SAMPLES_JOURNAL["v100"][0]["_"])
def extrated_selected_journal(issn): logger.info("Iniciando extração do journal %s" % issn) obj_journal = journal.ext_journal(issn) extrated_journal_data(obj_journal)