add tests, improve tests #855
Open
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.
While writing tests, I discovered that
allocation/views.pylikes to domessage.errorfollowed byHttpResponseRedirect, and the test cases only checkresponse.status_code, which is either 200 or 301, depending on iffollowwas specified. I added a new utility to check bothresponse.status_codeand check for error messages.test_allocationchangedetailview_post_denytest_allocationchangeview_post_extensiontest_allocationchangeview_post_no_changetest_allocationcreateview_post_zeroquantitytest_centersummary_renderstest_allocationchangedetailview_accessrenamed totest_allocationchangedetailview_access_grantedto differentiate it fromtest_allocationchangedetailview_access_deniedtest_allocationchangeview_post_extension:self.post_datato prevent this test from messing up other tests with its specificpost_dataAllocationViewBaseTest:end_datetocls.allocationso that the new end date could be calculated after approving an end date extensioncls.quota_attribute.allocation_attribute_typechangeabletest_allocationchangedetailview_post_deny: tweaked to usestatus.name(string) instead ofstatus_id(object primary key), more intuitivetest_allocationchangedetailview_access_deniedtest_allocationchangedetailview_post_approve_end_date_extensiontest_allocationchangedetailview_post_approve_attribute_changetest_allocationchangedetailview_post_update_end_date_extensiontest_allocationchangeview_post_attribute_changeAlso added documentation to explain the diffrence between
AllocationChangeViewandAllocationChangeDetailView, and theirget_allocation_attributes_to_change, which share the same name but do different things.