Skip to content

[Reference PR] VRL - OSF Part #11108

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 44 commits into
base: develop
Choose a base branch
from
Draft
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
1b63bb5
set user_reference_uri upon authentication
adlius Feb 8, 2025
3162dfe
implemnted communication from GV to OSF and addon action logging
opaduchak Apr 9, 2025
ce8d261
Merge pull request #10965 from adlius/share-sessions
adlius Apr 9, 2025
fe53f50
fixed task implementation to fail when needed
opaduchak Apr 10, 2025
d2ddec1
lovered external task queues priority
opaduchak Apr 10, 2025
f076506
fixed arror handling accordng to comments
opaduchak Apr 15, 2025
d0f1cfb
fixed boolean experession
opaduchak Apr 15, 2025
837252b
Merge pull request #11088 from opaduchak/feature/ENG-7756
cslzchen Apr 15, 2025
538798a
Merge remote-tracking branch 'upstream/develop' into feature/verified…
cslzchen Apr 15, 2025
d42d058
added verifiedlinks retrieval
opaduchak Apr 25, 2025
30efb7a
implemented sending verified links to share
opaduchak Apr 28, 2025
a7ed9be
fixed tests
opaduchak Apr 29, 2025
cac9e32
added retries
opaduchak Apr 29, 2025
00ddf75
Merge remote-tracking branch 'upstream/develop' into feature/verified…
cslzchen Apr 29, 2025
c88c0a0
fixed retries to be celery reties, fixed resource type for share
opaduchak Apr 29, 2025
2ad923d
fixed gv request mocking
opaduchak Apr 29, 2025
2711c05
fixed share serializer tests
opaduchak Apr 30, 2025
20f702d
fixed recent comments
opaduchak Apr 30, 2025
174c7bc
Merge pull request #11113 from opaduchak/feature/ENG-7769
cslzchen May 1, 2025
1a94180
Add new task to update node metadata with verified_links
Vlad0n20 Apr 8, 2025
609bf29
Update task to change node metadata to use gv request to get verified…
Vlad0n20 Apr 29, 2025
57f9639
Add mock for gravy valet get_links to fix failed tests
Vlad0n20 May 1, 2025
029c6db
Fix test_doi_synced_datacite test
Vlad0n20 May 1, 2025
d05c9a2
Update PR accordng to comments
Vlad0n20 May 5, 2025
fae9a54
Remove autouse=True for mock_gravy_valet_get_links
Vlad0n20 May 8, 2025
ab27f65
Add mock_gravy_valet_get_links where it is needed
Vlad0n20 May 8, 2025
a591f6d
Update using fixture for some tests
Vlad0n20 May 8, 2025
d6aa9de
add project overview page topnav for linked services
adlius May 13, 2025
8f375d4
Change places where autouse=True for fixure to use this decorator @p…
Vlad0n20 May 15, 2025
89b5a3d
Update expected metadate files for tests
Vlad0n20 May 15, 2025
4053369
Remove useless fixture
Vlad0n20 May 16, 2025
e07289f
Change fixture name for test_serialized_metadata test
Vlad0n20 May 16, 2025
b7373f4
Merge pull request #11141 from CenterForOpenScience/add-project-topna…
cslzchen May 16, 2025
bdf0224
Rewrite error handling when retrieving verified links in tree walker
cslzchen May 16, 2025
79506cc
Update comments, docsting and logging
cslzchen May 16, 2025
2190a32
Tweak conidtion check
cslzchen May 16, 2025
1686ef8
Merge pull request #11130 from Vlad0n20/feature/ENG-7839
cslzchen May 16, 2025
67638af
added share update to task__update_doi_metadata_with_verified_links
opaduchak May 19, 2025
21657bb
Merge remote-tracking branch 'upstream/develop' into feature/verified…
cslzchen May 20, 2025
b34f395
Fix duplicate import of settings
cslzchen May 20, 2025
6ad9ed6
Remove unnecessary import alias for settings
cslzchen May 20, 2025
bb4e3ba
renamed task__update_doi_metadata_with_verified_links
opaduchak May 27, 2025
d50bb2e
split updates into two separate try-except
opaduchak May 28, 2025
cc09e05
Merge pull request #11146 from opaduchak/feature/ENG-7771
cslzchen May 28, 2025
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
1 change: 1 addition & 0 deletions admin_tests/nodes/test_views.py
Original file line number Diff line number Diff line change
@@ -546,6 +546,7 @@ def setUp(self):
self.user = AuthUserFactory()
self.node = ProjectFactory(creator=self.user)

@pytest.mark.usefixtures('mock_gravy_valet_get_verified_links')
def test_request_approval_is_approved(self):
now = timezone.now()
self.approval = RegistrationApprovalFactory(
7 changes: 7 additions & 0 deletions admin_tests/registrations/test_registrations.py
Original file line number Diff line number Diff line change
@@ -92,12 +92,14 @@ def test_embargoed_registration_from_changed_to_private_project_spam_ham(self, e
embargoed_registration_from_changed_to_private_project.confirm_ham(save=True)
assert not embargoed_registration_from_changed_to_private_project.is_public

@pytest.mark.usefixtures('mock_gravy_valet_get_verified_links')
def test_public_registration_from_public_project_spam_ham(self, superuser, public_registration_from_public_project):
public_registration_from_public_project.confirm_spam(save=True)
assert not public_registration_from_public_project.is_public
public_registration_from_public_project.confirm_ham(save=True)
assert public_registration_from_public_project.is_public

@pytest.mark.usefixtures('mock_gravy_valet_get_verified_links')
def test_public_registration_from_private_project_spam_ham(self, superuser, public_registration_from_private_project):
public_registration_from_private_project.confirm_spam(save=True)
assert not public_registration_from_private_project.is_public
@@ -110,18 +112,21 @@ def test_private_registration_from_private_project_spam_ham(self, superuser, pri
private_registration_from_public_project.confirm_ham(save=True)
assert not private_registration_from_public_project.is_public

@pytest.mark.usefixtures('mock_gravy_valet_get_verified_links')
def test_public_registration_from_changed_to_public_project_spam_ham(self, superuser, public_registration_from_changed_to_public_project):
public_registration_from_changed_to_public_project.confirm_spam(save=True)
assert not public_registration_from_changed_to_public_project.is_public
public_registration_from_changed_to_public_project.confirm_ham(save=True)
assert public_registration_from_changed_to_public_project.is_public

@pytest.mark.usefixtures('mock_gravy_valet_get_verified_links')
def test_public_registration_from_changed_to_private_project_spam_ham(self, superuser, public_registration_from_changed_to_private_project):
public_registration_from_changed_to_private_project.confirm_spam(save=True)
assert not public_registration_from_changed_to_private_project.is_public
public_registration_from_changed_to_private_project.confirm_ham(save=True)
assert public_registration_from_changed_to_private_project.is_public

@pytest.mark.usefixtures('mock_gravy_valet_get_verified_links')
def test_unapproved_registration_task(self, embargoed_registration_from_changed_to_public_project):
embargoed_registration_from_changed_to_public_project.registration_approval.state = 'unapproved'
embargoed_registration_from_changed_to_public_project.registration_approval.initiation_date -= timedelta(3)
@@ -131,6 +136,7 @@ def test_unapproved_registration_task(self, embargoed_registration_from_changed_
embargoed_registration_from_changed_to_public_project.registration_approval.refresh_from_db()
assert embargoed_registration_from_changed_to_public_project.registration_approval.state == 'approved'

@pytest.mark.usefixtures('mock_gravy_valet_get_verified_links')
def test_unapproved_registration_task_after_spam(self, embargoed_registration_from_changed_to_public_project):
embargoed_registration_from_changed_to_public_project.registration_approval.state = 'unapproved'
embargoed_registration_from_changed_to_public_project.registration_approval.initiation_date -= timedelta(3)
@@ -141,6 +147,7 @@ def test_unapproved_registration_task_after_spam(self, embargoed_registration_fr
embargoed_registration_from_changed_to_public_project.registration_approval.refresh_from_db()
assert embargoed_registration_from_changed_to_public_project.registration_approval.state == 'unapproved'

@pytest.mark.usefixtures('mock_gravy_valet_get_verified_links')
def test_unapproved_registration_task_after_spam_ham(self, embargoed_registration_from_changed_to_public_project):
embargoed_registration_from_changed_to_public_project.registration_approval.state = 'unapproved'
embargoed_registration_from_changed_to_public_project.registration_approval.initiation_date -= timedelta(3)
22 changes: 14 additions & 8 deletions api/share/utils.py
Original file line number Diff line number Diff line change
@@ -12,6 +12,7 @@
from framework.celery_tasks.handlers import enqueue_task
from framework.encryption import ensure_bytes
from framework.sentry import log_exception
from osf.external.gravy_valet.exceptions import GVException
from osf.metadata.osf_gathering import (
OsfmapPartition,
pls_get_magic_metadata_basket,
@@ -78,15 +79,20 @@ def task__update_share(self, guid: str, is_backfill=False, osfmap_partition_name
raise ValueError(f'unknown osfguid "{guid}"')
_resource = _osfid_instance.referent
_is_deletion = _should_delete_indexcard(_resource)
_response = (
pls_delete_trove_record(_resource, osfmap_partition=_osfmap_partition)
if _is_deletion
else pls_send_trove_record(
_resource,
is_backfill=is_backfill,
osfmap_partition=_osfmap_partition,
try:
_response = (
pls_delete_trove_record(_resource, osfmap_partition=_osfmap_partition)
if _is_deletion
else pls_send_trove_record(
_resource,
is_backfill=is_backfill,
osfmap_partition=_osfmap_partition,
)
)
)
except GVException as e:
log_exception(e)
raise self.retry(exc=e)

try:
_response.raise_for_status()
except Exception as e:
4 changes: 4 additions & 0 deletions api_tests/identifiers/managment_commands/test_sync_dois.py
Original file line number Diff line number Diff line change
@@ -53,6 +53,7 @@ def preprint_identifier(self, preprint):
identifier.save(update_modified=False)
return identifier

@pytest.mark.usefixtures('mock_gravy_valet_get_verified_links')
@pytest.mark.enable_enqueue_task
def test_doi_synced_datacite(self, app, registration, registration_identifier, mock_datacite):
assert registration_identifier.modified.date() < datetime.datetime.now().date()
@@ -66,6 +67,7 @@ def test_doi_synced_datacite(self, app, registration, registration_identifier, m
registration_identifier.reload()
assert registration_identifier.modified.date() == datetime.datetime.now().date()

@pytest.mark.usefixtures('mock_gravy_valet_get_verified_links')
@pytest.mark.enable_enqueue_task
def test_doi_synced_crossref(self, app, preprint_identifier, mock_crossref):
assert preprint_identifier.modified.date() < datetime.datetime.now().date()
@@ -77,6 +79,7 @@ def test_doi_synced_crossref(self, app, preprint_identifier, mock_crossref):
preprint_identifier.reload()
assert preprint_identifier.modified.date() == datetime.datetime.now().date()

@pytest.mark.usefixtures('mock_gravy_valet_get_verified_links')
@pytest.mark.enable_enqueue_task
def test_doi_sync_private(self, app, registration_private, registration_identifier, mock_datacite):

@@ -91,6 +94,7 @@ def test_doi_sync_private(self, app, registration_private, registration_identifi
assert registration_identifier.modified.date() < datetime.datetime.now().date()
assert registration_identifier.modified.date() < datetime.datetime.now().date()

@pytest.mark.usefixtures('mock_gravy_valet_get_verified_links')
@pytest.mark.enable_enqueue_task
def test_doi_sync_public_only(self, app, registration_private, registration_identifier, mock_datacite):
call_command('sync_doi_metadata', f'-m={datetime.datetime.now()}')
1 change: 1 addition & 0 deletions api_tests/identifiers/views/test_identifier_list.py
Original file line number Diff line number Diff line change
@@ -475,6 +475,7 @@ def ark_payload(self):
def client(self, resource):
return DataCiteClient(resource)

@pytest.mark.usefixtures('mock_gravy_valet_get_verified_links')
@responses.activate
def test_create_identifier(self, app, resource, client, identifier_url, identifier_payload, user,
write_contributor, read_contributor, ark_payload):
6 changes: 6 additions & 0 deletions api_tests/registrations/views/test_registration_detail.py
Original file line number Diff line number Diff line change
@@ -335,6 +335,8 @@ def license_cc0(self):
@pytest.mark.django_db
@pytest.mark.enable_implicit_clean
class TestRegistrationUpdate(TestRegistrationUpdateTestCase):

@pytest.mark.usefixtures('mock_gravy_valet_get_verified_links')
def test_update_registration(
self, app, user, read_only_contributor,
read_write_contributor, public_registration,
@@ -415,6 +417,7 @@ def test_update_registration(
expect_errors=True)
assert res.status_code == 403

@pytest.mark.usefixtures('mock_gravy_valet_get_verified_links')
def test_fields(
self, app, user, public_registration,
private_registration, public_url, institution_one,
@@ -561,6 +564,7 @@ def test_fields(
expect_errors=True)
assert res.status_code == 400

@pytest.mark.usefixtures('mock_gravy_valet_get_verified_links')
def test_turning_private_registrations_public(
self, app, user, make_payload):
private_project = ProjectFactory(creator=user, is_public=False)
@@ -776,6 +780,7 @@ def test_initiate_withdrawal_success(self, mock_send_mail, app, user, public_reg
assert public_registration.registered_from.logs.first().action == 'retraction_initiated'
assert mock_send_mail.called

@pytest.mark.usefixtures('mock_gravy_valet_get_verified_links')
def test_initiate_withdrawal_with_embargo_ends_embargo(
self, app, user, public_project, public_registration, public_url, public_payload):
public_registration.embargo_registration(
@@ -934,6 +939,7 @@ def new_tag_payload_withdrawn(self, registration_withdrawn):
}
}

@pytest.mark.usefixtures('mock_gravy_valet_get_verified_links')
def test_registration_tags(
self, app, registration_public, registration_private,
url_registration_public, url_registration_private,
Original file line number Diff line number Diff line change
@@ -68,7 +68,15 @@ def test_registrations_children_list(self, user, app, registration_with_children
assert component_one._id in ids
assert component_two._id in ids

def test_return_registrations_list_no_auth_approved(self, user, app, registration_with_children_approved, registration_with_children_approved_url):
@pytest.mark.usefixtures('mock_gravy_valet_get_verified_links')
def test_return_registrations_list_no_auth_approved(
self,
user,
app,
registration_with_children_approved,
registration_with_children_approved_url
):

component_one, component_two, component_three, component_four = registration_with_children_approved.nodes

res = app.get(registration_with_children_approved_url)
Original file line number Diff line number Diff line change
@@ -224,6 +224,7 @@ def test_field_specific_related_counts_retrieved_if_visible_field_on_withdrawn_r
assert res.status_code == 200
assert res.json['data']['relationships']['contributors']['links']['related']['meta']['count'] == 1

@pytest.mark.usefixtures('mock_gravy_valet_get_verified_links')
def test_child_inherits_withdrawal_justification_and_date_withdrawn(
self, app, user, withdrawn_registration_with_child, registration_with_child):

7 changes: 7 additions & 0 deletions api_tests/registries_moderation/test_submissions.py
Original file line number Diff line number Diff line change
@@ -312,6 +312,7 @@ def test_registries_moderation_permission_log(self, app, registration_log_url, r
resp = app.get(registration_log_url, auth=moderator.auth)
assert resp.status_code == 200

@pytest.mark.usefixtures('mock_gravy_valet_get_verified_links')
def test_registries_moderation_post_accept(self, app, registration, moderator, registration_actions_url, actions_payload_base, reg_creator):
registration.require_approval(user=registration.creator)
registration.registration_approval.accept()
@@ -378,6 +379,7 @@ def test_registries_moderation_post_embargo_reject(self, app, embargo_registrati
embargo_registration.refresh_from_db()
assert embargo_registration.moderation_state == RegistrationModerationStates.REJECTED.db_name

@pytest.mark.usefixtures('mock_gravy_valet_get_verified_links')
def test_registries_moderation_post_withdraw_accept(self, app, retract_registration, moderator, retract_registration_actions_url, actions_payload_base, provider):
retract_registration.sanction.accept()
retract_registration.refresh_from_db()
@@ -408,6 +410,7 @@ def test_registries_moderation_post_withdraw_reject(self, app, retract_registrat
retract_registration.refresh_from_db()
assert retract_registration.moderation_state == RegistrationModerationStates.ACCEPTED.db_name

@pytest.mark.usefixtures('mock_gravy_valet_get_verified_links')
def test_registries_moderation_post_force_withdraw(self, app, registration, moderator, registration_actions_url, actions_payload_base, provider, reg_creator):
registration.require_approval(user=registration.creator)
registration.registration_approval.accept()
@@ -477,6 +480,7 @@ def test_registries_moderation_post_embargo_admin_cant_accept(self, app, embargo
resp = app.post_json_api(embargo_registration_actions_url, actions_payload_base, auth=reg_creator.auth, expect_errors=True)
assert resp.status_code == 403

@pytest.mark.usefixtures('mock_gravy_valet_get_verified_links')
def test_registries_moderation_post_admin_cant_force_withdraw(self, app, registration, moderator, registration_actions_url, actions_payload_base, provider, reg_creator):
registration.require_approval(user=registration.creator)

@@ -509,6 +513,7 @@ def test_registries_moderation_post_admin_cant_force_withdraw(self, app, registr
RegistrationModerationTriggers.REJECT_SUBMISSION
]
)
@pytest.mark.usefixtures('mock_gravy_valet_get_verified_links')
def test_post_submission_action_persists_comment(self, app, registration, moderator, registration_actions_url, actions_payload_base, moderator_trigger):
assert registration.actions.count() == 0
registration.require_approval(user=registration.creator)
@@ -692,6 +697,7 @@ def test_public_project_with_embargo_is_private_after_spam_and_ham_and_moderatio
assert registration.moderation_state == RegistrationModerationStates.EMBARGO.db_name
assert registration.is_public is False

@pytest.mark.usefixtures('mock_gravy_valet_get_verified_links')
def test_private_project_without_embargo_is_public_after_spam_and_ham_and_moderation_approval(self, app, registration, moderator, registration_actions_url, actions_payload_base, provider):
user = AuthUserFactory()
user.is_staff = True
@@ -728,6 +734,7 @@ def test_private_project_without_embargo_is_public_after_spam_and_ham_and_modera
assert registration.moderation_state == RegistrationModerationStates.ACCEPTED.db_name
assert registration.is_public is True

@pytest.mark.usefixtures('mock_gravy_valet_get_verified_links')
def test_public_project_without_embargo_is_public_after_spam_and_ham_and_moderation_approval(self, app, registration, moderator, registration_actions_url, actions_payload_base, provider):
user = AuthUserFactory()
user.is_staff = True
1 change: 1 addition & 0 deletions api_tests/search/serializers/test_serializers.py
Original file line number Diff line number Diff line change
@@ -16,6 +16,7 @@
@pytest.mark.django_db
class TestSearchSerializer:

@pytest.mark.usefixtures('mock_gravy_valet_get_verified_links')
def test_search_serializer_mixed_model(self):

user = AuthUserFactory()
1 change: 1 addition & 0 deletions api_tests/search/views/test_views.py
Original file line number Diff line number Diff line change
@@ -566,6 +566,7 @@ def registration_private(self, project_private, schema):
registration_private.update_search()
return registration_private

@pytest.mark.usefixtures('mock_gravy_valet_get_verified_links')
def test_search_registrations(
self, app, url_registration_search, user, user_one, user_two,
registration, registration_public, registration_private):
Loading

Unchanged files with check annotations Beta

registration = self._get_registration()
if registration.is_spammy:
raise NodeStateError('Cannot approve a spammy registration')

Check failure on line 880 in osf/models/sanctions.py

GitHub Actions / api1_and_js

Cannot approve a spammy registration

Check failure on line 880 in osf/models/sanctions.py

GitHub Actions / api1_and_js

Cannot approve a spammy registration

Check failure on line 880 in osf/models/sanctions.py

GitHub Actions / api1_and_js

Cannot approve a spammy registration

Check failure on line 880 in osf/models/sanctions.py

GitHub Actions / api1_and_js

Cannot approve a spammy registration
super()._on_complete(event_data)
self.save()