Skip to content

Commit

Permalink
Merge pull request #2 from maykinmedia/feature/django-3.2
Browse files Browse the repository at this point in the history
[#2251] Updating package to 3.2
  • Loading branch information
alextreme authored May 12, 2023
2 parents 9880da4 + afa9baf commit b5b174c
Show file tree
Hide file tree
Showing 15 changed files with 68 additions and 17 deletions.
Empty file added blogapp/__init__.py
Empty file.
3 changes: 3 additions & 0 deletions blogapp/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.contrib import admin

# Register your models here.
6 changes: 6 additions & 0 deletions blogapp/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class BlogappConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'blogapp'
Empty file added blogapp/migrations/__init__.py
Empty file.
11 changes: 11 additions & 0 deletions blogapp/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from django.db import models


# Create your models here.
class Blog(models.Model):
title = models.CharField(max_length=100)
content = models.TextField()
date_posted = models.DateTimeField(auto_now_add=True)

def __str__(self):
return self.title
3 changes: 3 additions & 0 deletions blogapp/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.test import TestCase

# Create your tests here.
3 changes: 3 additions & 0 deletions blogapp/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.shortcuts import render

# Create your views here.
2 changes: 1 addition & 1 deletion djangocms_export_page/mixins.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from django.core.urlresolvers import reverse
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _

from .constants import FILE_FORMATS
Expand Down
Empty file added tests/__init__.py
Empty file.
12 changes: 12 additions & 0 deletions tests/factories.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import factory

from blogapp.models import Blog


class BlogFactory(factory.django.DjangoModelFactory):
class Meta:
model = Blog

title = factory.Faker('sentence', nb_words=4)
content = factory.Faker('text')

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 %}

9 changes: 4 additions & 5 deletions tests/test_models.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
from test.blog.tests.factories import BlogFactory

from django.test import RequestFactory, TestCase, override_settings

from ..export.common import PageExport
from ..export.docx import DocxPageExport
from djangocms_export_page.export.common import PageExport
from djangocms_export_page.export.docx import DocxPageExport
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
20 changes: 11 additions & 9 deletions tests/test_pages.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
from test.plugins.tests.factories import PageFactory

from django.test import RequestFactory, TestCase

from cms.api import add_plugin
from cms.api import add_plugin, create_page
from cms.models import Placeholder
from meta.views import Meta
from mock import patch

from ..export.common import Field, PageExport
from ..export.docx import DocxPageExport
from djangocms_export_page.export.common import Field, PageExport
from djangocms_export_page.export.docx import DocxPageExport


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 = PageFactory()
self.page.placeholders.add(self.placeholder)
self.page = create_page('test', 'test.html', 'nl')
self.placeholder = self.page.placeholders.get(slot='test')
self.language = 'nl'
self.request = RequestFactory().get('/nl/')

Expand All @@ -29,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
2 changes: 1 addition & 1 deletion tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.test import TestCase

from ..utils import clean_value
from djangocms_export_page.utils import clean_value


class CleanValueTests(TestCase):
Expand Down
4 changes: 3 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
[tox]
envlist =
py36-django20
py310-django32
isort
; docs
skip_missing_interpreters = true

[travis:env]
DJANGO =
2.0: django20
3.2: django32

[testenv]
extras =
tests
coverage
deps =
django20: Django>=2.0,<2.1
django32: Django>=3.2,<3.3
commands =
py.test tests \
--junitxml=reports/junit.xml \
Expand Down

0 comments on commit b5b174c

Please sign in to comment.