def test_logs_exception_if_update_aop_bundle_items_raise_exception( self, mk_open, mk_update_aop_bundle_items, mk_get_or_create_bundle, mk_get_bundle_id, mk_regdocument, MockLogger): mk_open.return_value.__enter__.return_value.read.return_value = ( '{"0034-8910": "0101-0101"}') mk_get_bundle_id.return_value = "0034-8910-2014-v48-n2" error = LinkDocumentToDocumentsBundleException( "No AOP Bundle in Journal") error.response = Mock(status_code=404) mk_update_aop_bundle_items.side_effect = error link_documents_to_documentsbundle("path_to_sps_package/package.zip", self.documents, "/json/index.json") MockLogger.error.assert_called_with("No AOP Bundle in Journal")
def raise_exception(*args, **kwargs): exc = LinkDocumentToDocumentsBundleException("Bundle not found") exc.response = Mock(status_code=404) raise exc