From 780a26997fbe7ebf09ddddd6d7d22d147875df8f Mon Sep 17 00:00:00 2001 From: Oksamies Date: Tue, 3 Sep 2024 13:50:09 +0300 Subject: [PATCH] Widen the schema_sync test --- django/thunderstore/schema_import/tests/test_sync.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/django/thunderstore/schema_import/tests/test_sync.py b/django/thunderstore/schema_import/tests/test_sync.py index 6d62bdf34..2bd40b5df 100644 --- a/django/thunderstore/schema_import/tests/test_sync.py +++ b/django/thunderstore/schema_import/tests/test_sync.py @@ -5,6 +5,7 @@ PackageCategory, PackageListingSection, ) +from thunderstore.community.models.package_listing import PackageListing from thunderstore.repository.models import PackageInstaller from thunderstore.schema_import.schema import Schema, SchemaPackageInstaller from thunderstore.schema_import.sync import ( @@ -30,15 +31,20 @@ def test_schema_sync(): assert Community.objects.count() == 0 assert PackageCategory.objects.count() == 0 assert PackageListingSection.objects.count() == 0 + assert PackageListing.objects.filter(is_auto_imported=True).count() == 0 sync_ecosystem_schema.delay() com_count = Community.objects.count() cat_count = PackageCategory.objects.count() sec_count = PackageListingSection.objects.count() + autolisted_pkg_count = PackageListing.objects.filter(is_auto_imported=True).count() + assert com_count > 0 assert cat_count > 0 assert sec_count > 0 + # TODO: Uncomment when schema has autolisted packages + # assert autolisted_pkg_count > 0 # Ensure idempotency sync_ecosystem_schema.delay() @@ -46,6 +52,10 @@ def test_schema_sync(): assert com_count == Community.objects.count() assert cat_count == PackageCategory.objects.count() assert sec_count == PackageListingSection.objects.count() + assert ( + autolisted_pkg_count + == PackageListing.objects.filter(is_auto_imported=True).count() + ) @pytest.mark.django_db