From 38fbe7cf85520588664d88e0a1f1a2d7f2b653d9 Mon Sep 17 00:00:00 2001 From: Iacopo Spalletti Date: Sun, 7 Feb 2016 13:00:25 +0100 Subject: [PATCH 1/4] Fix tests with parler>=1.6 --- tests/base.py | 24 +++++++++++++++--------- tests/test_menu.py | 1 + 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/tests/base.py b/tests/base.py index 6442506..cb6e3f3 100644 --- a/tests/base.py +++ b/tests/base.py @@ -6,6 +6,7 @@ from copy import deepcopy from cmsplugin_filer_image.models import ThumbnailOption from django.contrib.auth import get_user_model from django.contrib.sites.models import Site +from django.core.cache import cache from djangocms_helper.base_test import BaseTestCase from haystack import connections from haystack.constants import DEFAULT_ALIAS @@ -18,7 +19,7 @@ User = get_user_model() def _get_cat_pk(lang, name): - return lambda: BlogCategory.objects.translated(lang, name=name).get().pk + return lambda: BlogCategory.objects.language(lang).translated(lang, name=name).get().pk class BaseTest(BaseTestCase): @@ -65,7 +66,8 @@ class BaseTest(BaseTestCase): 'description': 'Descrizione del terzo post', 'keywords': 'keyword5, keyword6', 'text': 'Testo del terzo post'}, }, - {'en': {'title': 'Different appconfig', 'abstract': '

Different appconfig first line

', + {'en': {'title': 'Different appconfig', + 'abstract': '

Different appconfig first line

', 'description': 'Different appconfig description', 'keywords': 'keyword5, keyword6', 'text': 'Different appconfig text', 'app_config': 'sample_app2', 'publish': True}, 'it': {'title': 'Altro appconfig', 'abstract': '

prima riga del Altro appconfig

', @@ -84,17 +86,19 @@ class BaseTest(BaseTestCase): {'en': {'name': 'Almost', 'app_config': 'sample_app'}, 'it': {'name': 'Mezzo'}, }, - {'en': {'name': 'Loud', 'parent_id': _get_cat_pk('en', 'Almost'), 'app_config': 'sample_app'}, - 'it': {'name': 'Forte', 'parent_id': _get_cat_pk('it', 'Mezzo')}, - }, - {'en': {'name': 'Silent', 'parent_id': _get_cat_pk('en', 'Almost'), 'app_config': 'sample_app'}, - }, {'en': {'name': 'Drums', 'app_config': 'sample_app2'}, 'it': {'name': 'Tamburi'}, }, {'en': {'name': 'Guitars', 'app_config': 'sample_app2'}, 'it': {'name': 'Chitarre'}, }, + {'en': {'name': 'Loud', 'parent_id': _get_cat_pk('en', 'Almost'), + 'app_config': 'sample_app'}, + 'it': {'name': 'Forte', 'parent_id': _get_cat_pk('it', 'Mezzo')}, + }, + {'en': {'name': 'Silent', 'parent_id': _get_cat_pk('en', 'Almost'), + 'app_config': 'sample_app'}, + }, ) @classmethod @@ -120,11 +124,13 @@ class BaseTest(BaseTestCase): 'sample_app': cls.app_config_1, 'sample_app2': cls.app_config_2, } - cls.category_1 = BlogCategory.objects.create(name='category 1', app_config=cls.app_config_1) + cls.category_1 = BlogCategory.objects.create(name='category 1', + app_config=cls.app_config_1) cls.category_1.set_current_language('it', initialize=True) cls.category_1.name = 'categoria 1' cls.category_1.save() cls.site_2 = Site.objects.create(domain='http://example2.com', name='example 2') + cache.clear() @classmethod def tearDownClass(cls): @@ -168,7 +174,6 @@ class BaseTest(BaseTestCase): meta_description=data['description'], meta_keywords=data['keywords'] ) - post = self.reload_model(post) post.categories.add(self.category_1) if sites: for site in sites: @@ -177,6 +182,7 @@ class BaseTest(BaseTestCase): def get_posts(self, sites=None): posts = [] + cache.clear() for post in self._post_data: post1 = self._get_post(post['en'], sites=sites) post1 = self._get_post(post['it'], post=post1, lang='it') diff --git a/tests/test_menu.py b/tests/test_menu.py index ded13e1..2a67476 100644 --- a/tests/test_menu.py +++ b/tests/test_menu.py @@ -21,6 +21,7 @@ class MenuTest(BaseTest): def setUp(self): super(MenuTest, self).setUp() self.cats = [self.category_1] + cache.clear() for i, lang_data in enumerate(self._categories_data): cat = self._get_category(lang_data['en']) if 'it' in lang_data: From fe34a6ae0172af70287fa3bfbdbad798ca5a0494 Mon Sep 17 00:00:00 2001 From: Iacopo Spalletti Date: Sun, 7 Feb 2016 13:02:32 +0100 Subject: [PATCH 2/4] Use modern parler in tests --- requirements-test.txt | 1 + tox.ini | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/requirements-test.txt b/requirements-test.txt index 94e66fe..a9c6ae7 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -9,3 +9,4 @@ https://github.com/nephila/djangocms-helper/archive/develop.zip tox>=2.0 wheel pysolr +django-parler>=1.6 diff --git a/tox.ini b/tox.ini index 0ed8921..b4322e2 100644 --- a/tox.ini +++ b/tox.ini @@ -7,19 +7,19 @@ deps = -r{toxinidir}/requirements-test.txt django16: Django>=1.6,<1.7 django16: django-taggit<0.18 + django16: django-mptt<0.8 django17: Django>=1.7,<1.8 django18: Django>=1.8,<1.9 django19: Django>=1.9,<1.10 django19: https://github.com/divio/django-filer/archive/develop.zip django19: https://github.com/divio/cmsplugin-filer/archive/develop.zip cms30: https://github.com/divio/django-cms/archive/support/3.0.x.zip + cms30: django-mptt<0.8 cms31: https://github.com/divio/django-cms/archive/support/3.1.x.zip cms32: https://github.com/divio/django-cms/archive/release/3.2.x.zip https://github.com/nephila/django-meta-mixin/archive/master.zip https://github.com/nephila/djangocms-helper/archive/develop.zip py26: unittest2 - django-parler<1.5 - django-mptt<0.8 https://github.com/aldryn/aldryn-apphooks-config/archive/master.zip https://github.com/nephila/djangocms-apphook-setup/archive/master.zip From 5313642aaddf828a4cb2607807d1b22db97b8642 Mon Sep 17 00:00:00 2001 From: Iacopo Spalletti Date: Sun, 7 Feb 2016 16:38:11 +0100 Subject: [PATCH 3/4] Update changelog --- HISTORY.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/HISTORY.rst b/HISTORY.rst index b2cfb9a..5149e65 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -7,6 +7,7 @@ History ++++++++++++++++++ * Make categories non required +* Fix tests with parler>=1.6 0.6.3 (2015-12-22) ++++++++++++++++++ From 80778b9c04d5bbbf86deb0c66c56d6e6d36b47b9 Mon Sep 17 00:00:00 2001 From: Iacopo Spalletti Date: Sun, 7 Feb 2016 17:01:36 +0100 Subject: [PATCH 4/4] Fix mptt development fix --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 2b6da9f..8d74cd1 100644 --- a/tox.ini +++ b/tox.ini @@ -13,12 +13,12 @@ deps = django19: https://github.com/divio/django-filer/archive/develop.zip django19: https://github.com/divio/cmsplugin-filer/archive/develop.zip cms30: https://github.com/divio/django-cms/archive/support/3.0.x.zip - cms30: django-mptt<0.8 cms31: https://github.com/divio/django-cms/archive/support/3.1.x.zip cms32: https://github.com/divio/django-cms/archive/release/3.2.x.zip https://github.com/nephila/django-meta-mixin/archive/master.zip https://github.com/nephila/djangocms-helper/archive/develop.zip py26: unittest2 + django-mptt<0.8 https://github.com/aldryn/aldryn-apphooks-config/archive/master.zip https://github.com/nephila/djangocms-apphook-setup/archive/master.zip