예제 #1
0
def conversion_journal_to_bundle(journal: dict) -> None:
    """Transforma um objeto Journal (xylose) para o formato
    de dados equivalente ao persistido pelo Kernel em um banco
    mongodb"""

    _journal = Journal(journal)
    _bundle = xylose_converter.journal_to_kernel(_journal)
    return _bundle
    def test_bundle_metadata_fields_timestamps_and_created_date_should_be_equals(
            self):
        journal = journal_to_kernel(self._journal)

        for field, value in journal.get("metadata").items():
            if field == "status":
                continue

            date = value[0][0]
            with self.subTest(date=date):
                self.assertEqual(journal.get("created"), date)
예제 #3
0
 def test_journal_has_institution_responsible_for(self):
     journal = journal_to_kernel(self._journal)
     expected = tuple(
         [
             {
                 "name": "Sociedade Brasileira de Medicina Tropical - SBMT",
                 "country_code": "BR",
                 "country": "Brazil",
                 "state": "MG",
                 "city": "Uberaba",
             }
         ]
     )
     self.assertEqual(
         expected, get_metadata_item(journal, "institution_responsible_for")
     )
    def test_journal_status_timestamps_should_be_different_from_created_date(
            self):
        journal = journal_to_kernel(self._journal)
        _status = journal["metadata"]["status"]

        self.assertNotEqual(journal["created"], _status[1][0])
    def test_journal_has_status(self):
        journal = journal_to_kernel(self._journal)
        _status = journal["metadata"]["status"]

        self.assertEqual(2, len(_status))
        self.assertEqual("suspended-by-editor", _status[1][1]["reason"])
 def test_journal_has_electronic_issn(self):
     journal = journal_to_kernel(self._journal)
     self.assertEqual("2448-167X",
                      get_metadata_item(journal, "electronic_issn"))
예제 #7
0
 def test_journal_has_contact_email(self):
     journal = journal_to_kernel(self._journal)
     self.assertEqual("*****@*****.**", journal["metadata"]["contact"]["email"])
 def test_journal_has_contact_address(self):
     journal = journal_to_kernel(self._journal)
     self.assertEqual(
         "Rua de exemplo, 1, São Paulo, SP, Brasil",
         get_metadata_item(journal, "contact")["address"],
     )
 def test_journal_has_previous_journal(self):
     journal = journal_to_kernel(self._journal)
     self.assertIsNotNone(get_metadata_item(journal, "previous_journal"))
 def test_journal_has_subject_categories(self):
     journal = journal_to_kernel(self._journal)
     self.assertEqual(["AREA"],
                      get_metadata_item(journal, "subject_categories"))
 def test_journal_has_mission(self):
     journal = journal_to_kernel(self._journal)
     self.assertEqual(3, len(get_metadata_item(journal, "mission")))
 def test_journal_hasnt_title(self):
     del self.json_journal["v100"]
     journal = journal_to_kernel(self._journal)
     self.assertIsNone(get_metadata_item(journal, "title"))
 def test_raise_exception_if_journal_hasnt_id(self):
     with self.assertRaises(ValueError):
         del self.json_journal["v435"]
         del self.json_journal["v400"]
         journal_to_kernel(Journal(self.json_journal))
 def test_bundle_id_joins_acronym_and_collection(self):
     journal = journal_to_kernel(self._journal)
     self.assertEqual("0001-3714", journal["id"])
     self.assertEqual("0001-3714", journal["_id"])
예제 #15
0
 def test_journal_has_contact_address(self):
     journal = journal_to_kernel(self._journal)
     self.assertEqual(
         "Rua de exemplo, 1, São Paulo, SP, Brasil",
         journal["metadata"]["contact"]["address"],
     )
 def test_journal_has_subject_areas(self):
     journal = journal_to_kernel(self._journal)
     self.assertEqual(["HEALTH SCIENCES"],
                      get_metadata_item(journal, "subject_areas"))
 def test_journal_has_sponsors(self):
     journal = journal_to_kernel(self._journal)
     self.assertEqual([{
         "name": "SCIELO"
     }], get_metadata_item(journal, "sponsors"))
 def test_journal_has_title_iso(self):
     journal = journal_to_kernel(self._journal)
     self.assertEqual("sample.", get_metadata_item(journal, "title_iso"))
 def test_journal_has_online_submission_url(self):
     journal = journal_to_kernel(self._journal)
     self.assertIsNotNone(
         get_metadata_item(journal, "online_submission_url"))
 def test_journal_has_short_title(self):
     journal = journal_to_kernel(self._journal)
     self.assertEqual("sample", get_metadata_item(journal, "short_title"))
 def test_journal_has_contact_email(self):
     journal = journal_to_kernel(self._journal)
     self.assertEqual("*****@*****.**",
                      get_metadata_item(journal, "contact")["email"])
 def test_journal_has_scielo_issn(self):
     journal = journal_to_kernel(self._journal)
     self.assertEqual("0001-3714",
                      get_metadata_item(journal, "scielo_issn"))
 def test_journal_has_print_issn(self):
     journal = journal_to_kernel(self._journal)
     self.assertEqual("0001", get_metadata_item(journal, "print_issn"))
예제 #24
0
 def test_journal_has_subject_areas(self):
     journal = journal_to_kernel(self._journal)
     self.assertEqual(
         ["Health Sciences"], get_metadata_item(journal, "subject_areas")
     )