-
Notifications
You must be signed in to change notification settings - Fork 2
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
28 changed files
with
755 additions
and
66 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
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,3 +1,3 @@ | ||
from .cli import cli | ||
|
||
cli() | ||
cli() # pragma: no cover |
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
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,5 @@ | ||
messages = { | ||
"no_managepy": "app-enabler must be executed in the same directory as the project manage.py file", | ||
"install_error": "Package {package} not installable in the current virtualenv", | ||
"enable_error": "Package {package} not installed in the current virtualenv", | ||
} |
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
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 @@ | ||
Add tests |
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
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 |
---|---|---|
|
@@ -2,3 +2,5 @@ | |
coverage | ||
coveralls>=2.0 | ||
django-app-helper>=2.0.0 | ||
pytest | ||
pytest-cov |
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,78 @@ | ||
import os | ||
import shutil | ||
from pathlib import Path | ||
from typing import Any, Dict | ||
|
||
import pytest | ||
|
||
from app_enabler.install import install | ||
from app_enabler.patcher import setup_django | ||
from tests.utils import get_project_dir, unload_django, working_directory | ||
|
||
pytest_plugins = "pytester" | ||
|
||
|
||
@pytest.fixture | ||
def blog_package(): | ||
"""Ensure djangocms-blog is installed.""" | ||
install("djangocms-blog") | ||
|
||
|
||
@pytest.fixture | ||
def django_setup(project_dir: str): | ||
"""Setup django environment.""" | ||
with working_directory(project_dir): | ||
os.environ["DJANGO_SETTINGS_MODULE"] = "test_project.settings" | ||
setup_django() | ||
yield | ||
unload_django() | ||
|
||
|
||
@pytest.fixture | ||
def teardown_django(): | ||
""" | ||
Reset django imports and configuration, undoing django.setup call. | ||
Use this fixture whenever django.setup is called during test execution (either explicitly or implicitly). | ||
Already called by :py:func:`django_setup`. | ||
""" | ||
yield | ||
unload_django() | ||
|
||
|
||
@pytest.fixture | ||
def project_dir(pytester) -> Path: | ||
"""Create a temporary django project structure.""" | ||
original_project = get_project_dir() | ||
tmp_project = pytester.path / "tmp_project" | ||
shutil.rmtree(tmp_project, ignore_errors=True) | ||
shutil.copytree(original_project, tmp_project) | ||
yield tmp_project | ||
shutil.rmtree(tmp_project, ignore_errors=True) | ||
|
||
|
||
@pytest.fixture | ||
def addon_config() -> Dict[str, Any]: | ||
"""Sample addon config.""" | ||
return { | ||
"package-name": "djangocms-blog", | ||
"installed-apps": [ | ||
"filer", | ||
"easy_thumbnails", | ||
"aldryn_apphooks_config", | ||
"parler", | ||
"taggit", | ||
"taggit_autosuggest", | ||
"meta", | ||
"djangocms_blog", | ||
"sortedm2m", | ||
], | ||
"settings": { | ||
"META_SITE_PROTOCOL": "https", | ||
"META_USE_SITES": True, | ||
"MIDDLEWARE": ["django.middleware.gzip.GZipMiddleware"], | ||
}, | ||
"urls": [["", "djangocms_blog.taggit_urls"]], | ||
"message": "Please check documentation to complete the setup", | ||
} |
Oops, something went wrong.