Refactor database configuration to support PostgreSQL, add GIN index for operation_names, and enhance backup functionality
This commit is contained in:
parent
477bb753ae
commit
c41524e517
11 changed files with 250 additions and 74 deletions
|
|
@ -2,7 +2,6 @@ from __future__ import annotations
|
|||
|
||||
import json
|
||||
from pathlib import Path
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from django.test import TestCase
|
||||
|
||||
|
|
@ -16,9 +15,6 @@ from twitch.models import Organization
|
|||
from twitch.models import TimeBasedDrop
|
||||
from twitch.schemas import DropBenefitSchema
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from debug_toolbar.panels.templates.panel import QuerySet
|
||||
|
||||
|
||||
class GetOrUpdateBenefitTests(TestCase):
|
||||
"""Tests for the _get_or_update_benefit method in better_import_drops.Command."""
|
||||
|
|
@ -467,11 +463,9 @@ class OperationNameFilteringTests(TestCase):
|
|||
command.process_responses([viewer_drops_payload], Path("viewer.json"), {})
|
||||
command.process_responses([inventory_payload], Path("inventory.json"), {})
|
||||
|
||||
# Verify we can filter by operation_names
|
||||
# SQLite doesn't support JSON contains, so we filter in Python
|
||||
all_campaigns: QuerySet[DropCampaign, DropCampaign] = DropCampaign.objects.all()
|
||||
viewer_campaigns: list[DropCampaign] = [c for c in all_campaigns if "ViewerDropsDashboard" in c.operation_names]
|
||||
inventory_campaigns: list[DropCampaign] = [c for c in all_campaigns if "Inventory" in c.operation_names]
|
||||
# Verify we can filter by operation_names with JSON containment
|
||||
viewer_campaigns = DropCampaign.objects.filter(operation_names__contains=["ViewerDropsDashboard"])
|
||||
inventory_campaigns = DropCampaign.objects.filter(operation_names__contains=["Inventory"])
|
||||
|
||||
assert len(viewer_campaigns) >= 1
|
||||
assert len(inventory_campaigns) >= 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue