Skip to content
This repository has been archived by the owner on Jan 16, 2023. It is now read-only.

Commit

Permalink
fix: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
antonagestam committed Jan 4, 2020
1 parent 9632b3c commit 55a180b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 39 deletions.
47 changes: 11 additions & 36 deletions collectfast/tests/command/test_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,18 @@
STATICFILES_STORAGE="storages.backends.s3boto3.S3Boto3Storage",
COLLECTFAST_STRATEGY="collectfast.strategies.boto3.Boto3Strategy",
),
"boto": override_django_settings(
STATICFILES_STORAGE="storages.backends.s3boto.S3BotoStorage",
COLLECTFAST_STRATEGY="collectfast.strategies.boto.BotoStrategy",
}
all_backend_confs = {
**aws_backend_confs,
"gcloud": override_django_settings(
STATICFILES_STORAGE="storages.backends.gcloud.GoogleCloudStorage",
COLLECTFAST_STRATEGY="collectfast.strategies.gcloud.GoogleCloudStrategy",
),
"filesystem": override_django_settings(
STATICFILES_STORAGE="django.core.files.storage.FileSystemStorage",
COLLECTFAST_STRATEGY="collectfast.strategies.filesystem.FileSystemStrategy",
),
}
# use PEP448-style unpacking instead of copy+update once 3.4 support is dropped
all_backend_confs = aws_backend_confs.copy()
all_backend_confs.update(
{
"gcloud": override_django_settings(
STATICFILES_STORAGE="storages.backends.gcloud.GoogleCloudStorage",
COLLECTFAST_STRATEGY="collectfast.strategies.gcloud.GoogleCloudStrategy",
),
"filesystem": override_django_settings(
STATICFILES_STORAGE="django.core.files.storage.FileSystemStorage",
COLLECTFAST_STRATEGY="collectfast.strategies.filesystem.FileSystemStrategy",
),
}
)

make_test_aws_backends = test_many(**aws_backend_confs)
make_test_all_backends = test_many(**all_backend_confs)
Expand Down Expand Up @@ -89,26 +82,8 @@ def test_aws_is_gzipped(case: TestCase) -> None:
case.assertIn("0 static files copied.", call_collectstatic())


@make_test
@override_django_settings(
STATICFILES_STORAGE="storages.backends.s3boto.S3BotoStorage",
COLLECTFAST_STRATEGY=None,
)
def test_recognizes_boto_storage(case: TestCase) -> None:
case.assertEqual(Command._load_strategy().__name__, "BotoStrategy")


@make_test
@override_django_settings(
STATICFILES_STORAGE="storages.backends.s3boto3.S3Boto3Storage",
COLLECTFAST_STRATEGY=None,
)
def test_recognizes_boto3_storage(case: TestCase) -> None:
case.assertEqual(Command._load_strategy().__name__, "Boto3Strategy")


@make_test
@override_django_settings(STATICFILES_STORAGE=None, COLLECTFAST_STRATEGY=None)
def test_raises_for_unrecognized_storage(case: TestCase) -> None:
def test_raises_for_no_configured_strategy(case: TestCase) -> None:
with case.assertRaises(ImproperlyConfigured):
Command._load_strategy()
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@
license="MIT License",
include_package_data=True,
install_requires=[
"Django>=2.0",
"Django>=2.2",
"django-storages>=1.6",
'typing;python_version<"3.5"',
"typing-extensions",
],
classifiers=[
Expand Down
1 change: 0 additions & 1 deletion test-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
typing;python_version<"3.5"
typing-extensions
mock
coveralls
Expand Down

0 comments on commit 55a180b

Please sign in to comment.