Use djangocms-helper for tests
This commit is contained in:
parent
fc4d3a70f8
commit
fe7aaa688a
8 changed files with 77 additions and 24 deletions
|
@ -19,7 +19,7 @@ install:
|
||||||
- pip install -r requirements-test.txt
|
- pip install -r requirements-test.txt
|
||||||
|
|
||||||
# command to run tests, e.g. python setup.py test
|
# 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
|
after_success: coveralls
|
||||||
|
|
||||||
|
|
63
cms_helper.py
Normal file
63
cms_helper.py
Normal file
|
@ -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()
|
||||||
|
|
||||||
|
}
|
|
@ -5,3 +5,4 @@ mock>=1.0.1
|
||||||
nose>=1.3.0
|
nose>=1.3.0
|
||||||
django-nose>=1.2
|
django-nose>=1.2
|
||||||
flake8
|
flake8
|
||||||
|
https://github.com/nephila/djangocms-helper/archive/develop.zip
|
||||||
|
|
|
@ -107,8 +107,8 @@ class BaseTest(TestCase):
|
||||||
|
|
||||||
def get_pages(self):
|
def get_pages(self):
|
||||||
from cms.api import create_page, create_title
|
from cms.api import create_page, create_title
|
||||||
page = create_page(u'page one', 'page.html', language='en')
|
page = create_page(u'page one', 'fullwidth.html', language='en')
|
||||||
page_2 = create_page(u'page two', 'page.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='fr', title=u'page un', page=page)
|
||||||
create_title(language='it', title=u'pagina uno', page=page)
|
create_title(language='it', title=u'pagina uno', page=page)
|
||||||
for lang in self.languages:
|
for lang in self.languages:
|
||||||
|
|
|
@ -18,7 +18,7 @@ class PluginTest(BaseTest):
|
||||||
post1.tags.add('tag 1')
|
post1.tags.add('tag 1')
|
||||||
post1.publish = True
|
post1.publish = True
|
||||||
post1.save()
|
post1.save()
|
||||||
ph = page1.placeholders.get(slot='placeholder')
|
ph = page1.placeholders.get(slot='content')
|
||||||
plugin = add_plugin(ph, 'BlogLatestEntriesPlugin', language='en')
|
plugin = add_plugin(ph, 'BlogLatestEntriesPlugin', language='en')
|
||||||
tag = Tag.objects.get(slug='tag-1')
|
tag = Tag.objects.get(slug='tag-1')
|
||||||
plugin.tags.add(tag)
|
plugin.tags.add(tag)
|
||||||
|
@ -39,7 +39,7 @@ class PluginTest(BaseTest):
|
||||||
post1.save()
|
post1.save()
|
||||||
post2.publish = True
|
post2.publish = True
|
||||||
post2.save()
|
post2.save()
|
||||||
ph = page1.placeholders.get(slot='placeholder')
|
ph = page1.placeholders.get(slot='content')
|
||||||
plugin = add_plugin(ph, 'BlogAuthorPostsPlugin', language='en')
|
plugin = add_plugin(ph, 'BlogAuthorPostsPlugin', language='en')
|
||||||
plugin.authors.add(self.user)
|
plugin.authors.add(self.user)
|
||||||
request = self.get_page_request(page1, self.user, r'/en/blog/', lang_code='en', edit=True)
|
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.tags.add('test tag', 'another tag')
|
||||||
post2.publish = True
|
post2.publish = True
|
||||||
post2.save()
|
post2.save()
|
||||||
ph = page1.placeholders.get(slot='placeholder')
|
ph = page1.placeholders.get(slot='content')
|
||||||
plugin = add_plugin(ph, 'BlogTagsPlugin', language='en')
|
plugin = add_plugin(ph, 'BlogTagsPlugin', language='en')
|
||||||
request = self.get_page_request(page1, self.user, r'/en/blog/', lang_code='en', edit=True)
|
request = self.get_page_request(page1, self.user, r'/en/blog/', lang_code='en', edit=True)
|
||||||
context = RequestContext(request, {})
|
context = RequestContext(request, {})
|
||||||
|
@ -79,7 +79,7 @@ class PluginTest(BaseTest):
|
||||||
post1.save()
|
post1.save()
|
||||||
post2.publish = True
|
post2.publish = True
|
||||||
post2.save()
|
post2.save()
|
||||||
ph = page1.placeholders.get(slot='placeholder')
|
ph = page1.placeholders.get(slot='content')
|
||||||
plugin = add_plugin(ph, 'BlogCategoryPlugin', language='en')
|
plugin = add_plugin(ph, 'BlogCategoryPlugin', language='en')
|
||||||
request = self.get_page_request(page1, self.user, r'/en/blog/', lang_code='en', edit=True)
|
request = self.get_page_request(page1, self.user, r'/en/blog/', lang_code='en', edit=True)
|
||||||
plugin_class = plugin.get_plugin_class_instance()
|
plugin_class = plugin.get_plugin_class_instance()
|
||||||
|
@ -94,7 +94,7 @@ class PluginTest(BaseTest):
|
||||||
post1.save()
|
post1.save()
|
||||||
post2.publish = True
|
post2.publish = True
|
||||||
post2.save()
|
post2.save()
|
||||||
ph = page1.placeholders.get(slot='placeholder')
|
ph = page1.placeholders.get(slot='content')
|
||||||
plugin = add_plugin(ph, 'BlogArchivePlugin', language='en')
|
plugin = add_plugin(ph, 'BlogArchivePlugin', language='en')
|
||||||
request = self.get_page_request(page1, self.user, r'/en/blog/', lang_code='en', edit=True)
|
request = self.get_page_request(page1, self.user, r'/en/blog/', lang_code='en', edit=True)
|
||||||
plugin_class = plugin.get_plugin_class_instance()
|
plugin_class = plugin.get_plugin_class_instance()
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
{% include "page.html" %}
|
|
||||||
{% block content %}
|
|
||||||
<div class="app app-blog span8">
|
|
||||||
{% block content_blog %}{% endblock %}
|
|
||||||
</div>
|
|
||||||
{% endblock content %}
|
|
|
@ -1,9 +0,0 @@
|
||||||
{% load cms_tags sekizai_tags %}
|
|
||||||
{% render_block "css" %}
|
|
||||||
{% cms_toolbar %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
{% placeholder "placeholder" %}
|
|
||||||
{% endblock content %}
|
|
||||||
|
|
||||||
{% render_block "js" %}
|
|
6
tox.ini
6
tox.ini
|
@ -2,26 +2,30 @@
|
||||||
envlist = py26dj15, py26dj16, py27dj15, py27dj16
|
envlist = py26dj15, py26dj16, py27dj15, py27dj16
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
commands = python runtests.py
|
commands = djangocms-helper djangocms_blog test --cms --nose
|
||||||
deps =
|
deps =
|
||||||
-r{toxinidir}/requirements-test.txt
|
-r{toxinidir}/requirements-test.txt
|
||||||
|
|
||||||
[testenv:py26dj15]
|
[testenv:py26dj15]
|
||||||
|
basepython=python2.6
|
||||||
deps =
|
deps =
|
||||||
django<1.6
|
django<1.6
|
||||||
{[testenv]deps}
|
{[testenv]deps}
|
||||||
|
|
||||||
[testenv:py26dj16]
|
[testenv:py26dj16]
|
||||||
|
basepython=python2.6
|
||||||
deps =
|
deps =
|
||||||
django<1.7
|
django<1.7
|
||||||
{[testenv]deps}
|
{[testenv]deps}
|
||||||
|
|
||||||
[testenv:py27dj15]
|
[testenv:py27dj15]
|
||||||
|
basepython=python2.7
|
||||||
deps =
|
deps =
|
||||||
django<1.6
|
django<1.6
|
||||||
{[testenv]deps}
|
{[testenv]deps}
|
||||||
|
|
||||||
[testenv:py27dj16]
|
[testenv:py27dj16]
|
||||||
|
basepython=python2.7
|
||||||
deps =
|
deps =
|
||||||
django<1.7
|
django<1.7
|
||||||
{[testenv]deps}
|
{[testenv]deps}
|
||||||
|
|
Loading…
Reference in a new issue