Merge pull request #196 from nephila/feature/fix_parler

Feature/fix parler
This commit is contained in:
Iacopo Spalletti 2016-02-07 18:11:22 +01:00
commit d5449382c1
5 changed files with 18 additions and 10 deletions

View file

@ -7,6 +7,7 @@ History
++++++++++++++++++
* Make categories non required
* Fix tests with parler>=1.6
0.6.3 (2015-12-22)
++++++++++++++++++

View file

@ -9,3 +9,4 @@ https://github.com/nephila/djangocms-helper/archive/develop.zip
tox>=2.0
wheel
pysolr
django-parler>=1.6

View file

@ -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': '<p>Different appconfig first line</p>',
{'en': {'title': 'Different appconfig',
'abstract': '<p>Different appconfig first line</p>',
'description': 'Different appconfig description', 'keywords': 'keyword5, keyword6',
'text': 'Different appconfig text', 'app_config': 'sample_app2', 'publish': True},
'it': {'title': 'Altro appconfig', 'abstract': '<p>prima riga del Altro appconfig</p>',
@ -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')

View file

@ -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:

View file

@ -18,7 +18,6 @@ deps =
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