Ejemplo n.º 1
0
 def test_get_documents_bundle_success(self):
     session_db = Session()
     session_db.documents_bundles.add(
         inserting.ManifestDomainAdapter(SAMPLE_ISSUES_KERNEL[0]))
     result = inserting.get_documents_bundle(session_db, self.bundle_id,
                                             True, self.issn)
     self.assertIsInstance(result, DocumentsBundle)
     self.assertEqual(result.id(), "0001-3714-1998-v29-n3")
Ejemplo n.º 2
0
 def test_get_documents_bundle_success(self):
     session_db = Session()
     bundle = DocumentsBundle(manifest=SAMPLE_ISSUES_KERNEL[0])
     session_db.documents_bundles.add(bundle)
     result = inserting.get_documents_bundle(session_db, bundle.id(), True,
                                             "0987-0987")
     self.assertIsInstance(result, DocumentsBundle)
     self.assertEqual(result.id(), "0001-3714-1998-v29-n3")
Ejemplo n.º 3
0
 def test_get_documents_bundle_returns_created_aop_bundle(
         self, mk_create_aop_bundle):
     session_db = MagicMock()
     mocked_aop_bundle = Mock()
     session_db.documents_bundles.fetch.side_effect = DoesNotExist
     mk_create_aop_bundle.return_value = mocked_aop_bundle
     result = inserting.get_documents_bundle(session_db, self.bundle_id,
                                             False, self.issn)
     self.assertEqual(result, mocked_aop_bundle)
 def test_get_documents_bundle_uses_scielo_ids_generator_issue_id_if_issue(
     self, mk_issue_bundle_id
 ):
     result = inserting.get_documents_bundle(MagicMock(), self.data)
     mk_issue_bundle_id.assert_called_with(
         ANY,
         self.data["year"],
         self.data["volume"],
         self.data["number"],
         self.data["supplement"],
     )
 def test_get_documents_bundle_uses_scielo_ids_generator_aops_bundle_id_if_aop(
     self, mk_issue_bundle_id, mk_aops_bundle_id
 ):
     result = inserting.get_documents_bundle(MagicMock(), self.aop_data)
     mk_aops_bundle_id.assert_called()
     mk_issue_bundle_id.assert_not_called()