-
Notifications
You must be signed in to change notification settings - Fork 6
Submission dashboard should not show classic submissions in progress #68
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
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b884244
WIP test for get_user_submissions_fast
mhl10 1277d98
WIP update test that gets two NG-generated submissions for specified …
mhl10 d6d3c07
Filters get_user_submissions_fast to only return NG subs
bdc34 5d2d2ec
Removes TODO comment
bdc34 5b9c052
Moving add of classic submission in test.
bdc34 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -15,8 +15,8 @@ | |
| SetComments, SetAuthors, Announce, ConfirmAuthorship, ConfirmPolicy, \ | ||
| SetUploadPackage | ||
| from .. import init_app, create_all, drop_all, models, DBEvent, \ | ||
| get_submission, current_session, get_licenses, exceptions, store_event, \ | ||
| transaction | ||
| get_submission, get_user_submissions_fast, current_session, get_licenses, \ | ||
| exceptions, store_event, transaction | ||
|
|
||
| from .util import in_memory_db | ||
|
|
||
|
|
@@ -157,3 +157,91 @@ def test_get_submission_with_hold_and_reclass(self): | |
| self.assertTrue(submission_loaded.is_on_hold, | ||
| "Hold status should reflect hold action performed" | ||
| " outside the purview of the event model.") | ||
|
|
||
| def test_get_submission_list(self): | ||
| """Test that the set of submissions for a user can be retrieved.""" | ||
| user = User(42, '[email protected]', | ||
| endorsements=['astro-ph.GA', 'astro-ph.EP']) | ||
| events1 = [ | ||
| # first submission | ||
| CreateSubmission(creator=user), | ||
| SetTitle(creator=user, title='Foo title'), | ||
| SetAbstract(creator=user, abstract='Indeed' * 20), | ||
| SetAuthors(creator=user, authors=[ | ||
| Author(order=0, forename='Arthur', surname='Dent', | ||
| email='[email protected]'), | ||
| Author(order=1, forename='Ford', surname='Prefect', | ||
| email='[email protected]'), | ||
| ]), | ||
| SetLicense(creator=user, license_uri='http://creativecommons.org/publicdomain/zero/1.0/', | ||
| license_name='Foo zero 1.0'), | ||
| SetPrimaryClassification(creator=user, category='astro-ph.GA'), | ||
| ConfirmPolicy(creator=user), | ||
| SetUploadPackage(creator=user, identifier='1'), | ||
| ConfirmContactInformation(creator=user), | ||
| FinalizeSubmission(creator=user) | ||
| ] | ||
| events2 = [ | ||
| # second submission | ||
| CreateSubmission(creator=user), | ||
| SetTitle(creator=user, title='Bar title'), | ||
| SetAbstract(creator=user, abstract='Indubitably' * 20), | ||
| SetAuthors(creator=user, authors=[ | ||
| Author(order=0, forename='Jane', surname='Doe', | ||
| email='[email protected]'), | ||
| Author(order=1, forename='John', surname='Doe', | ||
| email='[email protected]'), | ||
| ]), | ||
| SetLicense(creator=user, license_uri='http://creativecommons.org/publicdomain/zero/1.0/', | ||
| license_name='Foo zero 1.0'), | ||
| SetPrimaryClassification(creator=user, category='astro-ph.GA'), | ||
| ConfirmPolicy(creator=user), | ||
| SetUploadPackage(creator=user, identifier='1'), | ||
| ConfirmContactInformation(creator=user), | ||
| FinalizeSubmission(creator=user) | ||
| ] | ||
|
|
||
| with in_memory_db(): | ||
| # User creates and finalizes submission. | ||
| with transaction(): | ||
| before = None | ||
| for i, event in enumerate(list(events1)): | ||
| event.created = datetime.now(UTC) | ||
| after = event.apply(before) | ||
| event, after = store_event(event, before, after) | ||
| events1[i] = event | ||
| before = after | ||
| submission1 = after | ||
| ident1 = submission1.submission_id | ||
|
|
||
| before = None | ||
| for i, event in enumerate(list(events2)): | ||
| event.created = datetime.now(UTC) | ||
| after = event.apply(before) | ||
| event, after = store_event(event, before, after) | ||
| events2[i] = event | ||
| before = after | ||
| submission2 = after | ||
| ident2 = submission2.submission_id | ||
|
|
||
| classic_sub = models.Submission( | ||
| type='new', | ||
| submitter_id=42) | ||
| session = current_session() | ||
| session.add(classic_sub) | ||
erickpeirson marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| # Now get the submissions for this user. | ||
| submissions = get_user_submissions_fast(42) | ||
| submission_loaded1, _ = get_submission(ident1) | ||
| submission_loaded2, _ = get_submission(ident2) | ||
|
|
||
| self.assertEqual(submission1.metadata.title, | ||
| submission_loaded1.metadata.title, | ||
| "Event-derived metadata for submission 1 should be preserved.") | ||
| self.assertEqual(submission2.metadata.title, | ||
| submission_loaded2.metadata.title, | ||
| "Event-derived metadata for submission 2 should be preserved.") | ||
|
|
||
| self.assertEqual(len(submissions), | ||
| 2, | ||
| "There should be exactly two NG submissions.") | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.