From 7e024c3d4467e4ee434467d8d12fe3d7dce2b70f Mon Sep 17 00:00:00 2001 From: ammirate Date: Tue, 12 Sep 2017 14:31:10 +0200 Subject: [PATCH] workflow: removed `prepare_update_payload` Signed-off-by: Antonio Cesarano Signed-off-by: Riccardo Candido This was an old attempt of merging records. --- inspirehep/modules/workflows/tasks/actions.py | 15 --------- .../modules/workflows/workflows/article.py | 2 -- .../workflows/test_workflows_tasks_actions.py | 31 ------------------- 3 files changed, 48 deletions(-) diff --git a/inspirehep/modules/workflows/tasks/actions.py b/inspirehep/modules/workflows/tasks/actions.py index 8e984584c0..af447ab5d4 100644 --- a/inspirehep/modules/workflows/tasks/actions.py +++ b/inspirehep/modules/workflows/tasks/actions.py @@ -227,21 +227,6 @@ def submission_fulltext_download(obj, eng): obj.log.info('Cannot fetch PDF provided by user from %s', submission_pdf) -def prepare_update_payload(extra_data_key="update_payload"): - @with_debug_logging - @wraps(prepare_update_payload) - def _prepare_update_payload(obj, eng): - # TODO: Perform auto-merge if possible and update only necessary data - # See obj.extra_data["record_matches"] for data on matches - - # FIXME: Just update entire record for now - obj.extra_data[extra_data_key] = obj.data - - _prepare_update_payload.__doc__ = ( - 'Prepare the update payload, extra_data_key=%s.' % extra_data_key) - return _prepare_update_payload - - @with_debug_logging def refextract(obj, eng): uri = get_pdf_in_workflow(obj) diff --git a/inspirehep/modules/workflows/workflows/article.py b/inspirehep/modules/workflows/workflows/article.py index 933d236a2f..432bf965a3 100644 --- a/inspirehep/modules/workflows/workflows/article.py +++ b/inspirehep/modules/workflows/workflows/article.py @@ -51,7 +51,6 @@ is_submission, is_arxiv_paper, mark, - prepare_update_payload, refextract, submission_fulltext_download, ) @@ -279,7 +278,6 @@ IF_ELSE( article_exists, [ - prepare_update_payload(extra_data_key="update_payload"), send_robotupload( marcxml_processor=hep2marc, mode="correct", diff --git a/tests/unit/workflows/test_workflows_tasks_actions.py b/tests/unit/workflows/test_workflows_tasks_actions.py index 70caf55fc6..a4b9d0c0bf 100644 --- a/tests/unit/workflows/test_workflows_tasks_actions.py +++ b/tests/unit/workflows/test_workflows_tasks_actions.py @@ -42,7 +42,6 @@ is_record_relevant, is_submission, mark, - prepare_update_payload, reject_record, refextract, shall_halt_workflow, @@ -431,36 +430,6 @@ def test_is_submission_returns_false_if_obj_has_falsy_acquisition_source(): assert not is_submission(obj, eng) -def test_prepare_update_payload(): - obj = MockObj({}, {}) - eng = MockEng() - - default_prepare_update_payload = prepare_update_payload() - - assert default_prepare_update_payload(obj, eng) is None - assert obj.extra_data['update_payload'] == {} - - -def test_prepare_update_payload_accepts_a_custom_key(): - obj = MockObj({}, {}) - eng = MockEng() - - custom_key_prepare_update_payload = prepare_update_payload('custom_key') - - assert custom_key_prepare_update_payload(obj, eng) is None - assert obj.extra_data['custom_key'] == {} - - -def test_prepare_update_payload_overwrites(): - obj = MockObj({'bar': 'baz'}, {'foo': 'foo'}) - eng = MockEng() - - foo_prepare_update_payload = prepare_update_payload('foo') - - assert foo_prepare_update_payload(obj, eng) is None - assert obj.extra_data['foo'] == {'bar': 'baz'} - - @patch('inspirehep.modules.workflows.tasks.actions.get_pdf_in_workflow') def test_refextract(mock_get_pdf_in_workflow): schema = load_schema('hep')