Skip to content

Commit

Permalink
Fix existing case-insensitive cyberstorm tests
Browse files Browse the repository at this point in the history
Fix tests in test_package_listing.py that relied on case
insensitivity.
  • Loading branch information
x753 committed Sep 24, 2024
1 parent dfe2b0b commit e01b725
Showing 1 changed file with 6 additions and 25 deletions.
31 changes: 6 additions & 25 deletions django/thunderstore/api/cyberstorm/tests/test_package_listing.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,25 +44,6 @@ def test_get_custom_package_listing__returns_objects_matching_args() -> None:
assert actual.package.name == expected.package.name


@pytest.mark.django_db
def test_get_custom_package_listing__treats_package_name_as_case_insensitive() -> None:
expected = PackageListingFactory()

requested_as_uppercase = get_custom_package_listing(
expected.community.identifier,
expected.package.namespace.name,
expected.package.name.upper(),
)
requested_as_lowercase = get_custom_package_listing(
expected.community.identifier,
expected.package.namespace.name,
expected.package.name.lower(),
)

assert requested_as_uppercase.package.name == expected.package.name
assert requested_as_lowercase.package.name == expected.package.name


@pytest.mark.django_db
def test_get_custom_package_listing__annotates_downloads_and_ratings() -> None:
listing = PackageListingFactory(package_version_kwargs={"downloads": 100})
Expand All @@ -82,7 +63,7 @@ def test_get_custom_package_listing__annotates_downloads_and_ratings() -> None:
actual = get_custom_package_listing(
listing.community.identifier,
listing.package.namespace.name,
listing.package.name.upper(),
listing.package.name,
)

assert actual.download_count == 123
Expand All @@ -109,7 +90,7 @@ def test_get_custom_package_listing__annotates_has_changelog(
actual = get_custom_package_listing(
listing.community.identifier,
listing.package.namespace.name,
listing.package.name.upper(),
listing.package.name,
)

assert actual.has_changelog == expected
Expand All @@ -127,7 +108,7 @@ def test_get_custom_package_listing__augments_listing_with_dependant_count() ->
actual = get_custom_package_listing(
listing.community.identifier,
listing.package.namespace.name,
listing.package.name.upper(),
listing.package.name,
)

assert actual.dependant_count == dependant_count
Expand All @@ -146,7 +127,7 @@ def test_get_custom_package_listing__augments_listing_with_dependency_count() ->
actual = get_custom_package_listing(
listing.community.identifier,
listing.package.namespace.name,
listing.package.name.upper(),
listing.package.name,
)

assert actual.dependency_count == dependency_count
Expand All @@ -169,7 +150,7 @@ def test_get_custom_package_listing__augments_listing_with_dependencies_from_sam
actual = get_custom_package_listing(
dependant.community.identifier,
dependant.package.namespace.name,
dependant.package.name.upper(),
dependant.package.name,
)

assert actual.dependencies.count() == 2
Expand All @@ -191,7 +172,7 @@ def test_get_custom_package_listing__when_many_dependencies__returns_only_four()
actual = get_custom_package_listing(
listing.community.identifier,
listing.package.namespace.name,
listing.package.name.upper(),
listing.package.name,
)

assert actual.dependencies.count() == 4
Expand Down

0 comments on commit e01b725

Please sign in to comment.