Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump django from 4.1.10 to 4.1.13 #142

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ Use 'x' to check each item: [x] I have ...
* [ ] I have opened this pull request against ``master``
* [ ] I have added or modified the tests when changing logic
* [ ] I have followed [the conventional commits guidelines](https://www.conventionalcommits.org/) to add meaningful information into the changelog
* [ ] I have read the [contribution guidelines ](https://github.com/django-cms/django-cms/blob/develop/CONTRIBUTING.rst) and I have joined #workgroup-pr-review on
* [ ] I have read the [contribution guidelines ](https://github.com/django-cms/django-cms/blob/develop/CONTRIBUTING.rst) and I have joined #workgroup-pr-review on
[Slack](https://www.django-cms.org/slack) to find a “pr review buddy” who is going to review my pull request.
14 changes: 7 additions & 7 deletions aldryn_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ class Form(forms.BaseForm):
required=False,
)
enable_search = forms.CheckboxField(
'Enable snippet content to be searchable.',
"Enable snippet content to be searchable.",
required=False,
initial=False,
)

def to_settings(self, data, settings):
if data['editor_theme']:
settings['DJANGOCMS_SNIPPET_THEME'] = data['editor_theme']
if data['editor_mode']:
settings['DJANGOCMS_SNIPPET_MODE'] = data['editor_mode']
if data['enable_search']:
settings['DJANGOCMS_SNIPPET_SEARCH'] = data['enable_search']
if data["editor_theme"]:
settings["DJANGOCMS_SNIPPET_THEME"] = data["editor_theme"]
if data["editor_mode"]:
settings["DJANGOCMS_SNIPPET_MODE"] = data["editor_mode"]
if data["enable_search"]:
settings["DJANGOCMS_SNIPPET_SEARCH"] = data["enable_search"]
return settings
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ click==8.0.3
# via pip-tools
distlib==0.3.4
# via virtualenv
django==4.1.10
django==4.1.13
# via
# django-classy-tags
# django-cms
Expand Down
25 changes: 14 additions & 11 deletions tests/settings.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
#!/usr/bin/env python
HELPER_SETTINGS = {
'INSTALLED_APPS': [
'tests.utils',
"INSTALLED_APPS": [
"tests.utils",
],
'CMS_LANGUAGES': {
1: [{
'code': 'en',
'name': 'English',
}]
"CMS_LANGUAGES": {
1: [
{
"code": "en",
"name": "English",
}
]
},
'LANGUAGE_CODE': 'en',
'ALLOWED_HOSTS': ['localhost'],
"LANGUAGE_CODE": "en",
"ALLOWED_HOSTS": ["localhost"],
}


def run():
from app_helper import runner
runner.cms('djangocms_snippet')

runner.cms("djangocms_snippet")

if __name__ == '__main__':

if __name__ == "__main__":
run()
17 changes: 8 additions & 9 deletions tests/test_migrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,23 @@


class MigrationTestCase(TestCase):

@override_settings(MIGRATION_MODULES={})
def test_for_missing_migrations(self):
output = StringIO()
options = {
'interactive': False,
'dry_run': True,
'stdout': output,
'check_changes': True,
"interactive": False,
"dry_run": True,
"stdout": output,
"check_changes": True,
}

try:
call_command('makemigrations', **options)
call_command("makemigrations", **options)
except SystemExit as e:
status_code = str(e)
else:
# the "no changes" exit code is 0
status_code = '0'
status_code = "0"

if status_code == '1':
self.fail('There are missing migrations:\n {}'.format(output.getvalue()))
if status_code == "1":
self.fail(f"There are missing migrations:\n {output.getvalue()}")
1 change: 0 additions & 1 deletion tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class SnippetModelTestCase(TestCase):

def setUp(self):
pass

Expand Down
34 changes: 25 additions & 9 deletions tests/test_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@


class SnippetPluginsTestCase(CMSTestCase):

def setUp(self):
self.language = "en"
self.home = create_page(
Expand All @@ -29,7 +28,9 @@ def tearDown(self):
self.superuser.delete()

def test_html_rendering(self):
request_url = self.page.get_absolute_url(self.language) + "?toolbar_off=true"
request_url = (
self.page.get_absolute_url(self.language) + "?toolbar_off=true"
)
snippet = Snippet.objects.create(
name="plugin_snippet",
html="<p>Hello World</p>",
Expand All @@ -52,7 +53,9 @@ def test_html_rendering(self):
self.assertIn(b"<p>Hello World</p>", response.content)

def test_failing_html_rendering(self):
request_url = self.page.get_absolute_url(self.language) + "?toolbar_off=true"
request_url = (
self.page.get_absolute_url(self.language) + "?toolbar_off=true"
)
snippet = Snippet.objects.create(
name="plugin_snippet",
html="{% import weirdness %}",
Expand All @@ -70,10 +73,14 @@ def test_failing_html_rendering(self):
response = self.client.get(request_url)

self.assertContains(response, "Invalid block tag on line 1")
self.assertContains(response, "Did you forget to register or load this tag?")
self.assertContains(
response, "Did you forget to register or load this tag?"
)

def test_template_rendering(self):
request_url = self.page.get_absolute_url(self.language) + "?toolbar_off=true"
request_url = (
self.page.get_absolute_url(self.language) + "?toolbar_off=true"
)
template = "snippet.html"
snippet = Snippet.objects.create(
name="plugin_snippet",
Expand All @@ -94,13 +101,22 @@ def test_template_rendering(self):
with self.login_user_context(self.superuser):
response = self.client.get(request_url)

self.assertNotIn("Template {} does not exist".format(template).encode(), response.content)
self.assertNotIn(b"context must be a dict rather than Context", response.content)
self.assertNotIn(b"context must be a dict rather than PluginContext", response.content)
self.assertNotIn(
f"Template {template} does not exist".encode(), response.content
)
self.assertNotIn(
b"context must be a dict rather than Context", response.content
)
self.assertNotIn(
b"context must be a dict rather than PluginContext",
response.content,
)
self.assertContains(response, "<p>Hello World Template</p>")

def test_failing_template_rendering(self):
request_url = self.page.get_absolute_url(self.language) + "?toolbar_off=true"
request_url = (
self.page.get_absolute_url(self.language) + "?toolbar_off=true"
)
template = "some_template"
snippet = Snippet.objects.create(
name="plugin_snippet",
Expand Down
36 changes: 15 additions & 21 deletions tests/test_templatetags.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@


class SnippetTemplateTagTestCase(TestCase):

def test_html_rendered(self):
snippet = Snippet.objects.create(
name="test snippet",
Expand All @@ -20,17 +19,15 @@ def test_html_rendered(self):

context = Context({"title": "world"})
template_to_render = Template(
'{% load snippet_tags %}'
'{% snippet_fragment "test_snippet" %}'
"{% load snippet_tags %}" '{% snippet_fragment "test_snippet" %}'
)
rendered_template = template_to_render.render(context)
self.assertInHTML('<p>hello world</p>', rendered_template)
self.assertInHTML("<p>hello world</p>", rendered_template)

# test html errors
context = Context({"title": "world"})
template_to_render = Template(
'{% load snippet_tags %}'
'{% snippet_fragment "test_snippet_2" %}'
"{% load snippet_tags %}" '{% snippet_fragment "test_snippet_2" %}'
)
with self.assertRaises(ObjectDoesNotExist):
# Snippet matching query does not exist.
Expand All @@ -50,29 +47,27 @@ def test_template_rendered(self):
# use a string to identify
context = Context({})
template_to_render = Template(
'{% load snippet_tags %}'
'{% snippet_fragment "test_snippet" %}'
"{% load snippet_tags %}" '{% snippet_fragment "test_snippet" %}'
)
rendered_template = template_to_render.render(context)
self.assertInHTML('<p>Hello World Template</p>', rendered_template)
self.assertInHTML("<p>Hello World Template</p>", rendered_template)

# use an id to identify
context = Context({})
template_to_render = Template(
'{% load snippet_tags %}'
'{% snippet_fragment 1 %}'
"{% load snippet_tags %}" "{% snippet_fragment 1 %}"
)
rendered_template = template_to_render.render(context)
self.assertInHTML('<p>Hello World Template</p>', rendered_template)
self.assertInHTML("<p>Hello World Template</p>", rendered_template)

# tests "or" functionality
context = Context({})
template_to_render = Template(
'{% load snippet_tags %}'
"{% load snippet_tags %}"
'{% snippet_fragment "test_snippet_1" or %}<p>hello world</p>{% endsnippet_fragment %}'
)
rendered_template = template_to_render.render(context)
self.assertInHTML('<p>hello world</p>', rendered_template)
self.assertInHTML("<p>hello world</p>", rendered_template)

def test_template_errors(self):
template = "does_not_exist.html"
Expand All @@ -87,16 +82,16 @@ def test_template_errors(self):

context = Context({})
template_to_render = Template(
'{% load snippet_tags %}'
'{% snippet_fragment "test_snippet" %}'
"{% load snippet_tags %}" '{% snippet_fragment "test_snippet" %}'
)
rendered_template = template_to_render.render(context)
self.assertIn('Template does_not_exist.html does not exist.', rendered_template)
self.assertIn(
"Template does_not_exist.html does not exist.", rendered_template
)

context = Context({})
template_to_render = Template(
'{% load snippet_tags %}'
'{% snippet_fragment "test_snippet_1" %}'
"{% load snippet_tags %}" '{% snippet_fragment "test_snippet_1" %}'
)
with self.assertRaises(ObjectDoesNotExist):
# Snippet object does not exist
Expand All @@ -106,6 +101,5 @@ def test_template_errors(self):
with self.assertRaises(TemplateSyntaxError):
# You need to specify at least a "snippet" ID, slug or instance
template_to_render = Template(
'{% load snippet_tags %}'
'{% snippet_fragment %}'
"{% load snippet_tags %}" "{% snippet_fragment %}"
)