-
Notifications
You must be signed in to change notification settings - Fork 1
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
Pivotal ID # 187921156: Enable users with ADMIN rights for a collection to set back release dates for public submissions #857
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Please consider my comments
when (val previous = rqt.previousVersion) { | ||
null -> if (releaseTime < today) throw PastReleaseDateException() | ||
else -> | ||
if (previous.released) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This block could be simplified by using if (releaseTime != previous.releaseTime)
since, once a submission is public, the date shouldn't be modified regardless if it's a past or future date
) { | ||
fun ensureSequence(prefix: String) { | ||
if (sequenceRepository.existsByPrefix(prefix).not()) sequenceRepository.save(DbSequence(prefix)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
} | ||
|
||
@Test | ||
fun `28-2 Modification date is changed beetween re submissions`() = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two tests could be merge into one since they're doing basically the same and the two conditions always have to be satisfied:
- Creation date is never changed
- Modification date is updated upon resubmission
Actually, we could validate that the modification date for version 2 is always in the future
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes we can merge it but I think is actually better to have each test and isolated as possible (that test a single feature). We do have that all around but in general the more specialized the better
} | ||
|
||
@Nested | ||
inner class NormalUser { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the rest of the tests we've been using RegularUser
rather than "Normal". Not saying it couldn't change, just pointing out what's already there
} | ||
|
||
@Test | ||
fun `28-4 Normal user re-submit an already released submission with a new release date in the future`() = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of "already released" we should use public
} | ||
|
||
@Test | ||
fun `28-5 Normal user re-submit a not released submission with a new release date in the past`() = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of "not released", we should use private
} | ||
|
||
@Test | ||
fun `28-7 Admin make a public submission private`() = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a couple of tests to cover this in ResubmissionApiTest. We should remove or migrate those here since they're date related. Specifically
5-4 | regular user suppresses own submission
5-5 | super user suppresses submission from another user
https://www.pivotaltracker.com/story/show/187921156