forked from CenterForOpenScience/osf.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request CenterForOpenScience#10655 from Johnetordoff/prepr…
…int-institutions-list-api [ENG-5844] Add preprint institution affiliation endpoint
- Loading branch information
Showing
17 changed files
with
2,254 additions
and
3,285 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import pytest | ||
from osf_tests.factories import PreprintFactory, AuthUserFactory | ||
from api.base.settings.defaults import API_BASE | ||
|
||
@pytest.fixture() | ||
def user(): | ||
return AuthUserFactory() | ||
|
||
@pytest.mark.django_db | ||
class TestPreprintDelete: | ||
|
||
@pytest.fixture() | ||
def unpublished_preprint(self, user): | ||
return PreprintFactory(creator=user, is_published=False) | ||
|
||
@pytest.fixture() | ||
def published_preprint(self, user): | ||
return PreprintFactory(creator=user) | ||
|
||
@pytest.fixture() | ||
def url(self, user): | ||
return '/{}preprints/{{}}/'.format(API_BASE) | ||
|
||
def test_cannot_delete_preprints(self, app, user, url, unpublished_preprint, published_preprint): | ||
res = app.delete(url.format(unpublished_preprint._id), auth=user.auth, expect_errors=True) | ||
assert res.status_code == 405 | ||
assert unpublished_preprint.deleted is None | ||
|
||
res = app.delete(url.format(published_preprint._id), auth=user.auth, expect_errors=True) | ||
assert res.status_code == 405 | ||
assert published_preprint.deleted is None |
Oops, something went wrong.