diff --git a/.travis.yml b/.travis.yml index 3980152..0a79f43 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,7 @@ install: - pip install -r requirements-test.txt # command to run tests, e.g. python setup.py test -script: coverage run runtests.py +script: coverage run djangocms-helper djangocms_blog test --cms --nose after_success: coveralls diff --git a/cms_helper.py b/cms_helper.py new file mode 100644 index 0000000..5e07b29 --- /dev/null +++ b/cms_helper.py @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- +from tempfile import mkdtemp +gettext = lambda s: s + +HELPER_SETTINGS = { + 'NOSE_ARGS':['-s'], + 'ROOT_URLCONF':'tests.test_utils.urls', + 'INSTALLED_APPS':[ + 'django_nose', + 'filer', + 'parler', + 'taggit', + 'meta', + 'meta_mixin', + 'easy_thumbnails', + 'djangocms_text_ckeditor', + 'cmsplugin_filer_image', + 'django_select2', + 'taggit_autosuggest', + 'djangocms_blog', + ], + 'LANGUAGE_CODE':'en', + 'LANGUAGES':( + ('en', gettext('English')), + ('fr', gettext('French')), + ('it', gettext('Italiano')), + ), + 'CMS_LANGUAGES':{ + 1: [ + { + 'code': 'en', + 'name': gettext('English'), + 'public': True, + }, + { + 'code': 'it', + 'name': gettext('Italiano'), + 'public': True, + }, + { + 'code': 'fr', + 'name': gettext('French'), + 'public': True, + }, + ], + 'default': { + 'hide_untranslated': False, + }, + }, + 'META_SITE_PROTOCOL':'http', + 'META_SITE_DOMAIN':'example.com', + 'META_USE_OG_PROPERTIES':True, + 'META_USE_TWITTER_PROPERTIES':True, + 'META_USE_GOOGLEPLUS_PROPERTIES':True, + 'THUMBNAIL_PROCESSORS':( + 'easy_thumbnails.processors.colorspace', + 'easy_thumbnails.processors.autocrop', + 'filer.thumbnail_processors.scale_and_crop_with_subject_location', + 'easy_thumbnails.processors.filters', + ), + 'FILE_UPLOAD_TEMP_DIR':mkdtemp() + +} \ No newline at end of file diff --git a/requirements-test.txt b/requirements-test.txt index 5871396..f9a16a7 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -5,3 +5,4 @@ mock>=1.0.1 nose>=1.3.0 django-nose>=1.2 flake8 +https://github.com/nephila/djangocms-helper/archive/develop.zip diff --git a/tests/__init__.py b/tests/__init__.py index e3d5d12..330f661 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -107,8 +107,8 @@ class BaseTest(TestCase): def get_pages(self): from cms.api import create_page, create_title - page = create_page(u'page one', 'page.html', language='en') - page_2 = create_page(u'page two', 'page.html', language='en') + page = create_page(u'page one', 'fullwidth.html', language='en') + page_2 = create_page(u'page two', 'fullwidth.html', language='en') create_title(language='fr', title=u'page un', page=page) create_title(language='it', title=u'pagina uno', page=page) for lang in self.languages: diff --git a/tests/test_plugins.py b/tests/test_plugins.py index 5ea60c1..8f00f4f 100644 --- a/tests/test_plugins.py +++ b/tests/test_plugins.py @@ -18,7 +18,7 @@ class PluginTest(BaseTest): post1.tags.add('tag 1') post1.publish = True post1.save() - ph = page1.placeholders.get(slot='placeholder') + ph = page1.placeholders.get(slot='content') plugin = add_plugin(ph, 'BlogLatestEntriesPlugin', language='en') tag = Tag.objects.get(slug='tag-1') plugin.tags.add(tag) @@ -39,7 +39,7 @@ class PluginTest(BaseTest): post1.save() post2.publish = True post2.save() - ph = page1.placeholders.get(slot='placeholder') + ph = page1.placeholders.get(slot='content') plugin = add_plugin(ph, 'BlogAuthorPostsPlugin', language='en') plugin.authors.add(self.user) request = self.get_page_request(page1, self.user, r'/en/blog/', lang_code='en', edit=True) @@ -58,7 +58,7 @@ class PluginTest(BaseTest): post2.tags.add('test tag', 'another tag') post2.publish = True post2.save() - ph = page1.placeholders.get(slot='placeholder') + ph = page1.placeholders.get(slot='content') plugin = add_plugin(ph, 'BlogTagsPlugin', language='en') request = self.get_page_request(page1, self.user, r'/en/blog/', lang_code='en', edit=True) context = RequestContext(request, {}) @@ -79,7 +79,7 @@ class PluginTest(BaseTest): post1.save() post2.publish = True post2.save() - ph = page1.placeholders.get(slot='placeholder') + ph = page1.placeholders.get(slot='content') plugin = add_plugin(ph, 'BlogCategoryPlugin', language='en') request = self.get_page_request(page1, self.user, r'/en/blog/', lang_code='en', edit=True) plugin_class = plugin.get_plugin_class_instance() @@ -94,7 +94,7 @@ class PluginTest(BaseTest): post1.save() post2.publish = True post2.save() - ph = page1.placeholders.get(slot='placeholder') + ph = page1.placeholders.get(slot='content') plugin = add_plugin(ph, 'BlogArchivePlugin', language='en') request = self.get_page_request(page1, self.user, r'/en/blog/', lang_code='en', edit=True) plugin_class = plugin.get_plugin_class_instance() diff --git a/tests/test_utils/templates/base.html b/tests/test_utils/templates/base.html deleted file mode 100644 index 7d7532c..0000000 --- a/tests/test_utils/templates/base.html +++ /dev/null @@ -1,6 +0,0 @@ -{% include "page.html" %} -{% block content %} -
- {% block content_blog %}{% endblock %} -
-{% endblock content %} \ No newline at end of file diff --git a/tests/test_utils/templates/page.html b/tests/test_utils/templates/page.html deleted file mode 100644 index 1f1b1cf..0000000 --- a/tests/test_utils/templates/page.html +++ /dev/null @@ -1,9 +0,0 @@ -{% load cms_tags sekizai_tags %} -{% render_block "css" %} -{% cms_toolbar %} - -{% block content %} - {% placeholder "placeholder" %} -{% endblock content %} - -{% render_block "js" %} \ No newline at end of file diff --git a/tox.ini b/tox.ini index 9bee8cf..8fe6c8f 100644 --- a/tox.ini +++ b/tox.ini @@ -2,26 +2,30 @@ envlist = py26dj15, py26dj16, py27dj15, py27dj16 [testenv] -commands = python runtests.py +commands = djangocms-helper djangocms_blog test --cms --nose deps = -r{toxinidir}/requirements-test.txt [testenv:py26dj15] +basepython=python2.6 deps = django<1.6 {[testenv]deps} [testenv:py26dj16] +basepython=python2.6 deps = django<1.7 {[testenv]deps} [testenv:py27dj15] +basepython=python2.7 deps = django<1.6 {[testenv]deps} [testenv:py27dj16] +basepython=python2.7 deps = django<1.7 {[testenv]deps}