Skip to content

Fix failing tests with POSTs and PUTs

Andy Summers requested to merge more-failing-tests into master

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 requires spot_id and image_id parameters (meaning no constrain or thumb_dimensions). Also removed a trailing / from a thumbnail route to be consistent with the rest of the routes.
  • spotseeker_server/models.py
    • Added a __str__ implementation for ItemExtendedInfo to ease debugging. The object's representation is now (<id>) <key>: <value> item: <item_id>.
  • spotseeker_server/views/spot_item.py
    • Added a __str__ implementation to ItemStash to ease debugging. The object's representation is now the object's stored JSON
    • When checking for updated ItemExtendedInfo, use cleaned_data, not fields. fields returns a subclass of django.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 use get_or_create to either get an existing object or create a new object. Additionally, check if the value for the ItemExtendedInfo has changed, and set accordingly.

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

Merge request reports

Loading