Skip to content

Commit

Permalink
Re-add settings in cms_helper.py, override them in test classes
Browse files Browse the repository at this point in the history
  • Loading branch information
protoroto committed Aug 27, 2023
1 parent a8d4fa0 commit 9d110fd
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cms_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
HELPER_SETTINGS = dict(
ROOT_URLCONF="tests.example_app.urls",
INSTALLED_APPS=["meta", "tests.example_app"],
META_SITE_PROTOCOL="http",
META_USE_SITES=True,
META_USE_OG_PROPERTIES=True,
META_USE_TWITTER_PROPERTIES=True,
META_USE_SCHEMAORG_PROPERTIES=True,
FILE_UPLOAD_TEMP_DIR=mkdtemp(),
TEST_RUNNER="app_helper.pytest_runner.PytestTestRunner",
SECRET_KEY="dont-use-me",
Expand Down
7 changes: 7 additions & 0 deletions tests/test_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@
from meta.views import Meta


@override_settings(
META_SITE_PROTOCOL="",
META_USE_SITES=False,
META_USE_OG_PROPERTIES=False,
META_USE_TWITTER_PROPERTIES=False,
META_USE_SCHEMAORG_PROPERTIES=False,
)
class MetaObjectTestCase(TestCase):
def test_defaults(self):
m = Meta()
Expand Down
7 changes: 7 additions & 0 deletions tests/test_metadata_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
from meta.views import Meta, MetadataMixin


@override_settings(
META_SITE_PROTOCOL="",
META_USE_SITES=False,
META_USE_OG_PROPERTIES=False,
META_USE_TWITTER_PROPERTIES=False,
META_USE_SCHEMAORG_PROPERTIES=False,
)
class MetadataMixinTestCase(TestCase):
def test_get_meta_class(self):
m = MetadataMixin()
Expand Down
1 change: 1 addition & 0 deletions tests/test_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ def test_templatetag_secure_image(self):

@override_settings(
META_USE_SITES=True,
META_USE_OG_PROPERTIES=False,
META_USE_TWITTER_PROPERTIES=True,
META_SITE_PROTOCOL="http",
META_USE_SCHEMAORG_PROPERTIES=True,
Expand Down

0 comments on commit 9d110fd

Please sign in to comment.