mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-21 10:11:08 -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:
43
rides/migrations/0003_add_company_model.py
Normal file
43
rides/migrations/0003_add_company_model.py
Normal file
@@ -0,0 +1,43 @@
|
||||
# Generated by Django 5.2.5 on 2025-08-16 23:12
|
||||
|
||||
import django.contrib.postgres.fields
|
||||
from django.db import migrations, models
|
||||
import django.utils.timezone
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("rides", "0002_add_business_constraints"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Company',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('created_at', models.DateTimeField(default=django.utils.timezone.now)),
|
||||
('updated_at', models.DateTimeField(auto_now=True)),
|
||||
('name', models.CharField(max_length=255)),
|
||||
('slug', models.SlugField(max_length=255, unique=True)),
|
||||
('roles', django.contrib.postgres.fields.ArrayField(
|
||||
base_field=models.CharField(
|
||||
choices=[('MANUFACTURER', 'Ride Manufacturer'), ('DESIGNER', 'Ride Designer'), ('OPERATOR', 'Park Operator'), ('PROPERTY_OWNER', 'Property Owner')],
|
||||
max_length=20
|
||||
),
|
||||
blank=True,
|
||||
default=list,
|
||||
size=None
|
||||
)),
|
||||
('description', models.TextField(blank=True)),
|
||||
('website', models.URLField(blank=True)),
|
||||
('founded_date', models.DateField(blank=True, null=True)),
|
||||
('rides_count', models.IntegerField(default=0)),
|
||||
('coasters_count', models.IntegerField(default=0)),
|
||||
],
|
||||
options={
|
||||
'verbose_name_plural': 'Companies',
|
||||
'ordering': ['name'],
|
||||
},
|
||||
),
|
||||
]
|
||||
Reference in New Issue
Block a user