import pytest from django.core.management import call_command from scouting.models import League, Player, PlayerSeasonStat @pytest.mark.django_db def test_seed_demo_data_creates_a_useful_scouting_board(): call_command("seed_demo_data") assert Player.objects.count() >= 24 assert PlayerSeasonStat.objects.count() >= 24 assert set(League.objects.values_list("code", flat=True)) >= { "LBA", "ACB", "ABA", "BBL", "BSL", "LNB", "ISBL", "NBL", "NZNBL", } @pytest.mark.django_db def test_seed_demo_data_is_idempotent(): call_command("seed_demo_data") first_count = Player.objects.count() call_command("seed_demo_data") assert Player.objects.count() == first_count