Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion admin_tests/preprints/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,8 @@ def withdrawal_request(self, preprint, submitter):
withdrawal_request.run_submit(submitter)
return withdrawal_request

def test_can_approve_withdrawal_request(self, withdrawal_request, submitter, preprint, admin):
@mock.patch('osf.models.preprint.update_or_enqueue_on_preprint_updated')
def test_can_approve_withdrawal_request(self, mocked_function, withdrawal_request, submitter, preprint, admin):
assert withdrawal_request.machine_state == DefaultStates.PENDING.value
original_comment = withdrawal_request.comment

Expand All @@ -552,6 +553,12 @@ def test_can_approve_withdrawal_request(self, withdrawal_request, submitter, pre
assert withdrawal_request.machine_state == DefaultStates.ACCEPTED.value
assert original_comment == withdrawal_request.target.withdrawal_justification

# share update is triggered when update "date_withdrawn" and "withdrawal_justification" throughout withdrawal process
updated_fields = mocked_function.call_args[1]['saved_fields']
assert 'date_withdrawn' in updated_fields
assert 'withdrawal_justification' in updated_fields
assert preprint.SEARCH_UPDATE_FIELDS.intersection(updated_fields)

def test_can_reject_withdrawal_request(self, withdrawal_request, admin, preprint):
assert withdrawal_request.machine_state == DefaultStates.PENDING.value

Expand Down
2 changes: 2 additions & 0 deletions osf/models/preprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@ class Preprint(DirtyFieldsMixin, VersionedGuidMixin, IdentifierMixin, Reviewable
'primary_file',
'contributors',
'tags',
'date_withdrawn',
'withdrawal_justification'
}

PREREG_LINK_INFO_CHOICES = [('prereg_designs', 'Pre-registration of study designs'),
Expand Down
Loading