From 2a25b738fdb82629bb488ac17135d25694953769 Mon Sep 17 00:00:00 2001 From: PascalEgn Date: Tue, 27 Aug 2024 17:32:11 +0200 Subject: [PATCH] workflows: remove prepare_keywords step --- .../modules/workflows/workflows/article.py | 2 - .../workflows/workflows/core_selection.py | 4 +- .../workflows/test_article_workflow.py | 63 ------------------- 3 files changed, 1 insertion(+), 68 deletions(-) diff --git a/inspirehep/modules/workflows/workflows/article.py b/inspirehep/modules/workflows/workflows/article.py index 30aeec146f..d71bccac7c 100644 --- a/inspirehep/modules/workflows/workflows/article.py +++ b/inspirehep/modules/workflows/workflows/article.py @@ -121,7 +121,6 @@ close_ticket, create_ticket, filter_keywords, - prepare_keywords, reply_ticket, send_to_legacy ) @@ -341,7 +340,6 @@ add_core, ), filter_keywords, - prepare_keywords, set_refereed_and_fix_document_type, fix_submission_number, IF(is_core, normalize_author_affiliations), diff --git a/inspirehep/modules/workflows/workflows/core_selection.py b/inspirehep/modules/workflows/workflows/core_selection.py index 98a832481b..16a866873c 100644 --- a/inspirehep/modules/workflows/workflows/core_selection.py +++ b/inspirehep/modules/workflows/workflows/core_selection.py @@ -13,8 +13,7 @@ add_core, halt_record, is_core, link_institutions_with_affiliations, load_record_from_hep, normalize_author_affiliations, remove_inspire_categories_derived_from_core_arxiv_categories) -from inspirehep.modules.workflows.tasks.submission import (create_ticket, - prepare_keywords) +from inspirehep.modules.workflows.tasks.submission import (create_ticket) from inspirehep.modules.workflows.tasks.upload import store_record from inspirehep.modules.workflows.utils import do_not_repeat @@ -35,7 +34,6 @@ class CoreSelection(object): IF_ELSE( is_core, [ - prepare_keywords, normalize_author_affiliations, link_institutions_with_affiliations, do_not_repeat("create_ticket_curator_core_publisher")( diff --git a/tests/integration/workflows/test_article_workflow.py b/tests/integration/workflows/test_article_workflow.py index 03bfa880bc..d39423b098 100644 --- a/tests/integration/workflows/test_article_workflow.py +++ b/tests/integration/workflows/test_article_workflow.py @@ -334,69 +334,6 @@ def test_set_fermilab_collection_even_when_record_is_hidden_and_affiliations_are assert workflow.data["_collections"] == expected_collections -@mock.patch( - "inspirehep.modules.workflows.tasks.classifier.json_api_request", - side_effect=fake_classifier_api_request, -) -@mock.patch( - "inspirehep.modules.workflows.tasks.magpie.json_api_request", - side_effect=fake_magpie_api_request, -) -@mock.patch("inspirehep.modules.workflows.tasks.upload.store_record") -@mock.patch( - "inspirehep.modules.workflows.tasks.submission.submit_rt_ticket", - return_value="1234", -) -@mock.patch("inspirehep.modules.workflows.tasks.submission.send_robotupload") -def test_keywords_are_stored_in_record_when_record_is_core( - mocked_api_request_magpie, - mocked_api_request_classifier, - mocked_robotupload, - mocked_create_ticket, - mocked_store_record, - mocked_external_services, - workflow_app, -): - record = { - "$schema": "https://labs.inspirehep.net/schemas/records/hep.json", - "titles": [ - {"title": "Update without conflicts title."}, - ], - "authors": [ - { - "full_name": "Some author", - "raw_affiliations": [ - { - "value": "Some longer description CErN? with proper keyword included" - } - ], - } - ], - "document_type": ["article"], - "_collections": ["Literature"], - "abstracts": [ - {"value": "Very interesting paper about the Higgs boson."}, - ], - "acquisition_source": { - "datetime": "2020-11-12T04:49:13.369515", - "method": "hepcrawl", - "submission_number": "978", - "source": "Elsevier", - }, - } - - expected_keywords = [ - {"value": "Higgs particle", "schema": "INSPIRE", "source": "classifier"} - ] - workflow = build_workflow(record) - start("article", object_id=workflow.id) - wf = workflow_object_class.get(workflow.id) - mark("approved", True)(workflow, None) - mark("core", True)(workflow, None) - wf.continue_workflow() - assert wf.data["keywords"] == expected_keywords - - @mock.patch( "inspirehep.modules.workflows.tasks.classifier.json_api_request", side_effect=fake_classifier_api_request,