mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-20 10:31:09 -05:00
Add comprehensive tests for Parks API and models
- Implemented extensive test cases for the Parks API, covering endpoints for listing, retrieving, creating, updating, and deleting parks. - Added tests for filtering, searching, and ordering parks in the API. - Created tests for error handling in the API, including malformed JSON and unsupported methods. - Developed model tests for Park, ParkArea, Company, and ParkReview models, ensuring validation and constraints are enforced. - Introduced utility mixins for API and model testing to streamline assertions and enhance test readability. - Included integration tests to validate complete workflows involving park creation, retrieval, updating, and deletion.
This commit is contained in:
@@ -165,6 +165,8 @@ class EditSubmission(TrackedModel):
|
||||
if self.submission_type == "CREATE":
|
||||
# Create new object
|
||||
obj = model_class(**prepared_data)
|
||||
# CRITICAL STYLEGUIDE FIX: Call full_clean before save
|
||||
obj.full_clean()
|
||||
obj.save()
|
||||
# Update object_id after creation
|
||||
self.object_id = getattr(obj, "id", None)
|
||||
@@ -174,8 +176,12 @@ class EditSubmission(TrackedModel):
|
||||
raise ValueError("Content object not found")
|
||||
for field, value in prepared_data.items():
|
||||
setattr(obj, field, value)
|
||||
# CRITICAL STYLEGUIDE FIX: Call full_clean before save
|
||||
obj.full_clean()
|
||||
obj.save()
|
||||
|
||||
# CRITICAL STYLEGUIDE FIX: Call full_clean before save
|
||||
self.full_clean()
|
||||
self.save()
|
||||
return obj
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user