This repository has been archived by the owner on Jan 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
98 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = "1.3.0" | ||
__version__ = "1.3.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
from .base import DisabledStrategy | ||
from .base import guess_strategy | ||
from .base import load_strategy | ||
from .base import Strategy | ||
|
||
__all__ = ("load_strategy", "guess_strategy", "Strategy") | ||
__all__ = ("load_strategy", "guess_strategy", "Strategy", "DisabledStrategy") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
from unittest import mock | ||
from unittest import TestCase | ||
|
||
from django.test import override_settings as override_django_settings | ||
|
||
from .utils import call_collectstatic | ||
from collectfast.tests.utils import clean_static_dir | ||
from collectfast.tests.utils import create_static_file | ||
from collectfast.tests.utils import make_test | ||
from collectfast.tests.utils import override_setting | ||
|
||
|
||
@make_test | ||
@override_django_settings( | ||
STATICFILES_STORAGE="django.contrib.staticfiles.storage.StaticFilesStorage" | ||
) | ||
def test_disable_collectfast_with_default_storage(case): | ||
# type: (TestCase) -> None | ||
clean_static_dir() | ||
create_static_file() | ||
case.assertIn("1 static file copied", call_collectstatic(disable_collectfast=True)) | ||
|
||
|
||
@make_test | ||
def test_disable_collectfast(case): | ||
# type: (TestCase) -> None | ||
clean_static_dir() | ||
create_static_file() | ||
case.assertIn("1 static file copied.", call_collectstatic(disable_collectfast=True)) | ||
|
||
|
||
@override_setting("enabled", False) | ||
@mock.patch("collectfast.management.commands.collectstatic.Command._load_strategy") | ||
def test_no_load_with_disable_setting(mocked_load_strategy): | ||
# type: (mock.MagicMock) -> None | ||
clean_static_dir() | ||
call_collectstatic() | ||
mocked_load_strategy.assert_not_called() | ||
|
||
|
||
@mock.patch("collectfast.management.commands.collectstatic.Command._load_strategy") | ||
def test_no_load_with_disable_flag(mocked_load_strategy): | ||
# type: (mock.MagicMock) -> None | ||
clean_static_dir() | ||
call_collectstatic(disable_collectfast=True) | ||
mocked_load_strategy.assert_not_called() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from io import StringIO | ||
from typing import Any | ||
|
||
from django.core.management import call_command | ||
|
||
|
||
def call_collectstatic(*args, **kwargs): | ||
# type: (Any, Any) -> str | ||
out = StringIO() | ||
call_command( | ||
"collectstatic", *args, verbosity=3, interactive=False, stdout=out, **kwargs | ||
) | ||
return out.getvalue() |