Skip to content

Commit

Permalink
workflow: removed prepare_update_payload
Browse files Browse the repository at this point in the history
Signed-off-by: Antonio Cesarano <[email protected]>
Signed-off-by: Riccardo Candido <[email protected]>

This was an old attempt of merging records.
  • Loading branch information
ammirate committed Sep 21, 2017
1 parent 08e2d59 commit 7e024c3
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 48 deletions.
15 changes: 0 additions & 15 deletions inspirehep/modules/workflows/tasks/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 0 additions & 2 deletions inspirehep/modules/workflows/workflows/article.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
is_submission,
is_arxiv_paper,
mark,
prepare_update_payload,
refextract,
submission_fulltext_download,
)
Expand Down Expand Up @@ -279,7 +278,6 @@
IF_ELSE(
article_exists,
[
prepare_update_payload(extra_data_key="update_payload"),
send_robotupload(
marcxml_processor=hep2marc,
mode="correct",
Expand Down
31 changes: 0 additions & 31 deletions tests/unit/workflows/test_workflows_tasks_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
is_record_relevant,
is_submission,
mark,
prepare_update_payload,
reject_record,
refextract,
shall_halt_workflow,
Expand Down Expand Up @@ -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')
Expand Down

0 comments on commit 7e024c3

Please sign in to comment.