Fix failing tests with POSTs and PUTs
This PR fixes additional failing tests, related to POST and PUT operations.
Detailed breakdown
-
spotseeker_server/urls.py
- Added a route that matches the name
item-image-thumb
that only requiresspot_id
andimage_id
parameters (meaning noconstrain
orthumb_dimensions
). Also removed a trailing/
from a thumbnail route to be consistent with the rest of the routes.
- Added a route that matches the name
-
spotseeker_server/models.py
- Added a
__str__
implementation forItemExtendedInfo
to ease debugging. The object's representation is now(<id>) <key>: <value> item: <item_id>
.
- Added a
-
spotseeker_server/views/spot_item.py
- Added a
__str__
implementation toItemStash
to ease debugging. The object's representation is now the object's stored JSON - When checking for updated
ItemExtendedInfo
, usecleaned_data
, notfields
.fields
returns a subclass ofdjango.forms.field.Field
, not the value of the field as is intended.cleaned_data
contains the validated field's value. - Do not instantiate models with
.save(commit=False)
, but rather useget_or_create
to either get an existing object or create a new object. Additionally, check if the value for theItemExtendedInfo
has changed, and set accordingly.
- Added a
The last not very notable change is to be a little more discerning in .gitignore
Where we stand now
After this PR, spotseeker_server has three remaining failing tests. Oddly, these tests only fail when running the entire test suite, so there's likely some test cleanup that isn't happening during the full run. Regardless, we're close!
Please review: @NUWAN.KUMARASIRI @TREFILEK @bjsousa