Skip to content
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

[ENG-6645] Fix api1_and_js failing tests - Part 1 (replaces #10832) #10879

Conversation

Vlad0n20
Copy link

@Vlad0n20 Vlad0n20 commented Dec 30, 2024

Purpose

Fix failing tests in api1_and_js

Replaces: #10832

Changes

Fix failing tests in api1_and_js

QA Notes

N/A

Documentation

N/A

Side Effects

N/A

Ticket

https://openscience.atlassian.net/browse/ENG-6645

@Vlad0n20 Vlad0n20 changed the base branch from develop to feature/preprints-doi-versioning December 30, 2024 15:07
@cslzchen cslzchen changed the title [ENG-6645]Fix/eng 6645 [ENG-6645] Fix api1_and_js failing tests (replaces https://github.com/CenterForOpenScience/osf.io/pull/10832) Dec 30, 2024
@cslzchen cslzchen changed the title [ENG-6645] Fix api1_and_js failing tests (replaces https://github.com/CenterForOpenScience/osf.io/pull/10832) [ENG-6645] Fix api1_and_js failing tests (replaces #10832) Dec 30, 2024
Copy link
Collaborator

@cslzchen cslzchen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition to comments, please take a look at 12 remaining failures. Fix them if easy, postpone them to another ticket if challenging.

  • 5 occurrences
api/preprints/views.py:91: in delete
    return super().delete(request, *args, **kwargs)
E   AttributeError: 'super' object has no attribute 'delete'
  • 2 occurrences
api/preprints/views.py:117: in get_preprint
    if preprint.deleted is not None:
E   AttributeError: 'NoneType' object has no attribute 'deleted'
  • Others
______________ TestPreprintProviderWithdrawalRequstList.test_list ______________
api_tests/providers/preprints/views/test_preprint_provider_request_list.py:49: in test_list
    assert len(res.json['data']) == 1
E   assert 0 == 1
E    +  where 0 = len([])
___________ TestPreprintActionFilters.test_filter_actions[moderator] ___________
api_tests/reviews/mixins/filter_mixins.py:146: in test_filter_actions
    assert expected == actual
E   AssertionError
__________ TestPreprintActionFilters.test_filter_actions[node_admin] ___________
api_tests/reviews/mixins/filter_mixins.py:146: in test_filter_actions
    assert expected == actual
E   AssertionError
_______________ TestPreprintVersion.test_pending_version_exists ________________
api_tests/preprints/views/test_preprint_versions.py:71: in test_pending_version_exists
    assert res.status_code == 409
E   assert 201 == 409
E    +  where 201 = <201 Created application/vnd.api+json body=b'{"data":...0"}}'/2594>.status_code
_________________ TestReviewActionFilters.test_filter_actions __________________
api_tests/reviews/mixins/filter_mixins.py:146: in test_filter_actions
    assert expected == actual
E   AssertionError

api/base/filters.py Outdated Show resolved Hide resolved
api/users/views.py Outdated Show resolved Hide resolved
osf/models/mixins.py Outdated Show resolved Hide resolved
@cslzchen
Copy link
Collaborator

cslzchen commented Jan 3, 2025

Rebased to fix conflicts and your previous one has been backed up in https://github.com/cslzchen/osf.io/tree/fix/ENG-6645-backup-before-rebase

api/preprints/views.py Outdated Show resolved Hide resolved
@@ -148,7 +148,7 @@ def test_claim_unauth_success_with_unknown_email(self, app, url, project, unreg_
def test_claim_unauth_success_with_preprint_id(self, app, url, preprint, unreg_user, mock_mail):
res = app.post_json_api(
url.format(unreg_user._id),
self.payload(email='[email protected]', id=preprint._id),
self.payload(email='[email protected]', id=preprint.get_guid()._id),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, get_guid()._id returns the latest version while id=preprint._id returns the current version, with this if, I think we are sending the the wrong email to pass the tests.

Here is the failure and I think we may have an actual bug.

 FAILED api_tests/users/views/test_user_claim.py::TestClaimUser::test_claim_unauth_success_with_preprint_id - webtest.app.AppError: Bad response: 404 Not Found (not 200 OK or 3xx redirect for http://localhost/v2/users/f8upx/claim/)
{"errors":[{"detail":"Unable to find specified record."}],"meta":{"version":"2.0"}}

I will revert the change in this PR and create another ticket on fixing this correctly.

Test: test_claim_unauth_success_with_preprint_id
Test: test_preprint_contributor_signal_sent_on_creation
@cslzchen cslzchen changed the title [ENG-6645] Fix api1_and_js failing tests (replaces #10832) [ENG-6645] Fix api1_and_js failing tests - Part 1 (replaces #10832) Jan 7, 2025
@cslzchen cslzchen merged commit 6d4313b into CenterForOpenScience:feature/preprints-doi-versioning Jan 7, 2025
4 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants