Add tests and fixture for EventTheme model
Introduce a new pytest fixture for creating EventTheme instances and add comprehensive unit tests covering its properties, relationships, and behaviors. These changes improve test coverage and ensure the EventTheme model functions as expected.
This commit is contained in:
@@ -3,7 +3,8 @@ import pytest
|
||||
import uuid
|
||||
from app.models.user import User
|
||||
from app.utils.test_utils import setup_test_db, teardown_test_db
|
||||
from app.models import GiftItem, GiftStatus, GiftPriority, RSVP, RSVPStatus, EventMedia, MediaType, MediaPurpose
|
||||
from app.models import GiftItem, GiftStatus, GiftPriority, RSVP, RSVPStatus, EventMedia, MediaType, MediaPurpose, \
|
||||
EventTheme
|
||||
|
||||
|
||||
@pytest.fixture(scope="function")
|
||||
@@ -111,3 +112,29 @@ def event_media_fixture(db_session, mock_user):
|
||||
db_session.add(event_media)
|
||||
db_session.commit()
|
||||
return event_media
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def event_theme_fixture(db_session):
|
||||
"""
|
||||
Fixture to create and return a default EventTheme instance.
|
||||
"""
|
||||
event_theme = EventTheme(
|
||||
id=uuid.uuid4(),
|
||||
name="Animal Theme",
|
||||
description="An animal-themed design for events.",
|
||||
preview_image_url="https://example.com/preview/animal_theme.jpg",
|
||||
color_palette={
|
||||
"primary": "#ff5722",
|
||||
"secondary": "#4caf50",
|
||||
"background": "#ffffff",
|
||||
"text": "#000000"
|
||||
},
|
||||
fonts={
|
||||
"header": "Roboto",
|
||||
"body": "Open Sans"
|
||||
}
|
||||
)
|
||||
db_session.add(event_theme)
|
||||
db_session.commit()
|
||||
return event_theme
|
||||
|
||||
Reference in New Issue
Block a user