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-thumbthat only requiresspot_idandimage_idparameters (meaning noconstrainorthumb_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 forItemExtendedInfoto 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 toItemStashto ease debugging. The object's representation is now the object's stored JSON - When checking for updated
ItemExtendedInfo, usecleaned_data, notfields.fieldsreturns a subclass ofdjango.forms.field.Field, not the value of the field as is intended.cleaned_datacontains the validated field's value. - Do not instantiate models with
.save(commit=False), but rather useget_or_createto either get an existing object or create a new object. Additionally, check if the value for theItemExtendedInfohas 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