Skip to content

Commit

Permalink
[#2251]Fix test test_pages & test_models
Browse files Browse the repository at this point in the history
  • Loading branch information
Coperh committed May 12, 2023
1 parent 2add5bd commit afa9baf
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
Empty file added tests/__init__.py
Empty file.
10 changes: 10 additions & 0 deletions tests/templates/test.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

{% load cms_tags %}


{% block content %}

{% placeholder 'test' %}

{% endblock content %}

4 changes: 2 additions & 2 deletions tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

from djangocms_export_page.export.common import PageExport
from djangocms_export_page.export.docx import DocxPageExport
from tests.factories import BlogFactory
from annefrank.blog.tests.factories import BlogFactory


@override_settings(ROOT_URLCONF='test.blog.tests.urls_tests')
@override_settings(ROOT_URLCONF='annefrank.blog.tests.urls_tests')
class ExportModelTests(TestCase):
def setUp(self):
self.object = BlogFactory()
Expand Down
10 changes: 7 additions & 3 deletions tests/test_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@


class ExportPageTests(TestCase):
"""
Needs test template setup in settings TEMPLATES and CMS_TEMPLATES
"""

def setUp(self):
self.placeholder = Placeholder.objects.create(slot='test')
self.page = create_page('test', 'test.html', 'nl')
self.page.placeholders.add(self.placeholder)
self.placeholder = self.page.placeholders.get(slot='test')
self.language = 'nl'
self.request = RequestFactory().get('/nl/')

Expand All @@ -27,7 +31,7 @@ def test_base_url(self):

def test_page_url(self):
export = PageExport(self.request, self.page, language=self.language)
self.assertEqual(export.page_url, 'http://example.com/nl/')
self.assertEqual(export.page_url, 'http://example.com/nl/test/')

@patch('djangocms_export_page.export.common.get_page_meta')
def test_meta_extra_custom_props(self, mock):
Expand Down

0 comments on commit afa9baf

Please sign in to comment.