Bugfix add validation to stop_date field in project#277
Merged
Conversation
rwrzesien
reviewed
Jun 4, 2019
managers/models.py
Outdated
| def clean(self) -> None: | ||
| super().clean() | ||
| if self.stop_date is not None: | ||
| if self.start_date > self.stop_date: |
Contributor
There was a problem hiding this comment.
This should be one-line condition.
rwrzesien
reviewed
Jun 4, 2019
managers/tests/test_unit_model.py
Outdated
| project.members.add(self.member) | ||
| self.assertTrue(project.members.all().filter(email=self.member.email).exists()) | ||
|
|
||
| def test_project_model_end_date_could_not_be_before_start_day(self): |
Contributor
There was a problem hiding this comment.
could_not_be => should_not_be
Contributor
Author
There was a problem hiding this comment.
lol what I wrote.. 🗡️ Done
rwrzesien
reviewed
Jun 4, 2019
managers/tests/test_unit_model.py
Outdated
| with self.assertRaises(ValidationError): | ||
| project.full_clean() | ||
| project.save() | ||
| self.assertTrue(not Project.objects.all().exists()) |
Contributor
There was a problem hiding this comment.
Use self.assertFalse().
You should also check the response message, if you have caught ValidationError from the right reasons
rwrzesien
reviewed
Jun 4, 2019
Contributor
rwrzesien
left a comment
There was a problem hiding this comment.
Looks good in general, but some improvements can be applied.
rwrzesien
approved these changes
Jun 5, 2019
3a1c442 to
753f679
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Resolves: #241
I think that removed test is useless because in opinion it is already tested by django, but you guys could say more about it :) Thanks!