Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace develop.py with manage.py (using django-app-manage/django-better-test) #3706

Merged
merged 41 commits into from Aug 17, 2015
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
cbba263
Ported develop.py to django-app-manage (and django-better-test)
ojii Dec 26, 2014
ee50e17
travis
ojii Dec 26, 2014
a9b9fdc
use DiscoveryTestRunner
ojii Dec 28, 2014
cad8ef2
more fixing
ojii Dec 28, 2014
6d45974
fixed encoding
ojii Dec 30, 2014
304c98c
Merge remote-tracking branch 'origin/develop' into kill-develop-py
ojii Jul 15, 2015
44d5659
fixed lots of stuff in the tests
ojii Jul 16, 2015
e9d226e
pinned hvad to bust pip cache
ojii Jul 16, 2015
5a7d484
removed useless assertNumQuery checks
ojii Jul 16, 2015
9873046
naive/aware dt objs
ojii Jul 16, 2015
27559af
pinned better-test/app-manage
ojii Jul 16, 2015
5f7e472
updated testing docs a bit
ojii Jul 16, 2015
37ecdce
force screen size in travis
ojii Jul 16, 2015
c47833d
Use cache for session
ojii Jul 16, 2015
271419c
removed django.middleware.doc.XViewMiddleware
ojii Jul 16, 2015
d2c5082
removed unused imports
ojii Jul 16, 2015
7ea48b6
fuzzier fuzzy test
ojii Jul 16, 2015
0f71d5f
updated django-app-manage
ojii Jul 16, 2015
c627296
updated django-better-test
ojii Jul 16, 2015
f18e9a6
updated django-better-test again
ojii Jul 16, 2015
b0fbff0
even more py26 fixes in better-test
ojii Jul 16, 2015
3796271
python 2.6 is hard
ojii Jul 16, 2015
5afe7f0
circular import
ojii Jul 17, 2015
5a74614
south support
ojii Jul 17, 2015
0785c32
fixed tests on 1.6
ojii Jul 17, 2015
5a9e9fb
Merge remote-tracking branch 'origin/develop' into tmp
ojii Jul 17, 2015
d587101
removed inspect calls
ojii Jul 17, 2015
1688e63
removed old import
ojii Jul 17, 2015
e28ff4f
some test cleanup
ojii Jul 20, 2015
7f0415f
moved TEMPLATE_DEBUG
ojii Jul 30, 2015
6cfadc2
upgraded django-app-manage to not cause warnings on Django 1.8
ojii Jul 30, 2015
0de305e
fixed import
ojii Jul 31, 2015
b4d20fb
updated django-better-test requirement for better non-sqlite support
ojii Jul 31, 2015
f653118
fixed requirements file typo
ojii Aug 12, 2015
2828377
Merge remote-tracking branch 'origin/develop' into kill-develop-py
ojii Aug 13, 2015
2147159
Fixed Python2.6 compatibility, updated django-better-test requirement
ojii Aug 13, 2015
8833c81
unsilence travis pip and upgrade better test
ojii Aug 13, 2015
ea98793
made ClearURLs no-op in Django > 1.6
ojii Aug 14, 2015
36d3560
removed unused line
ojii Aug 14, 2015
fadaa92
Django test case is only needed in Python 2.6, 2.7+ unittest test case
ojii Aug 14, 2015
8d2e971
fixed typo in class name
ojii Aug 14, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -39,7 +39,7 @@ install:
- if [ $DATABASE_URL == 'mysql://root@127.0.0.1/djangocms_test' ]; then pip install
-q mysql-python ; fi

script: coverage run --rcfile=.coverage.rc develop.py test --migrate
script: coverage run --rcfile=.coverage.rc manage.py test

after_success: coveralls --config_file=.coverage.rc --coveralls_yaml=.coveralls.yml

Expand Down
2 changes: 1 addition & 1 deletion cms/api.py
Expand Up @@ -15,7 +15,6 @@
from django.template.defaultfilters import slugify
from django.template.loader import get_template
from django.utils import six
from cms.admin.forms import save_permissions
from cms.app_base import CMSApp
from cms.apphook_pool import apphook_pool
from cms.constants import TEMPLATE_INHERITANCE_MAGIC
Expand Down Expand Up @@ -368,6 +367,7 @@ def create_page_user(created_by, user,

See docs/extending_cms/api_reference.rst for more info
"""
from cms.admin.forms import save_permissions
if grant_all:
# just be lazy
return create_page_user(created_by, user, True, True, True, True,
Expand Down
50 changes: 0 additions & 50 deletions cms/tests/__init__.py
@@ -1,50 +0,0 @@
# -*- coding: utf-8 -*-

from cms.tests.static_analysis import * # nopyflakes
from cms.tests.alias import * # nopyflakes
from cms.tests.admin import * # nopyflakes
from cms.tests.api import * # nopyflakes
from cms.tests.apphooks import * # nopyflakes
from cms.tests.django_load import * # nopyflakes
from cms.tests.docs import * # nopyflakes
from cms.tests.extensions import * # nopyflakes
from cms.tests.forms import * # nopyflakes
from cms.tests.i18n import * # nopyflakes
from cms.tests.mail import * # nopyflakes
from cms.tests.menu import * # nopyflakes
from cms.tests.menu_utils import * # nopyflakes
from cms.tests.multilingual import * # nopyflakes
from cms.tests.navextender import * # nopyflakes
from cms.tests.nonroot import * # nopyflakes
from cms.tests.page import * # nopyflakes
from cms.tests.permissions import * # nopyflakes
from cms.tests.permmod import * # nopyflakes
from cms.tests.placeholder import * # nopyflakes
from cms.tests.plugins import * # nopyflakes
from cms.tests.po import * # nopyflakes
from cms.tests.publisher import * # nopyflakes
from cms.tests.rendering import * # nopyflakes
from cms.tests.reversion_tests import * # nopyflakes
from cms.tests.security import * # nopyflakes
from cms.tests.settings import * # nopyflakes
from cms.tests.site import * # nopyflakes
from cms.tests.sitemap import * # nopyflakes
from cms.tests.static_placeholder import * # nopyflakes
from cms.tests.staticfiles import * # nopyflakes
from cms.tests.templatetags import * # nopyflakes
from cms.tests.templates import * # nopyflakes
from cms.tests.toolbar import * # nopyflakes
from cms.tests.toolbar_pool import * # nopyflakes
from cms.tests.urlutils import * # nopyflakes
from cms.tests.views import * # nopyflakes
from cms.tests.management import * # nopyflakes
from cms.tests.fixture_loading import * # nopyflakes
from cms.tests.menu_page_viewperm import * # nopyflakes
from cms.tests.menu_page_viewperm_staff import * # nopyflakes
from cms.tests.nested_plugins import * # nopyflakes
from cms.tests.check import * # nopyflakes
from cms.tests.frontend import * # nopyflakes
from cms.tests.signals import * # nopyflakes
from cms.tests.no_i18n import * # nopyflakes
from cms.tests.cache import * # nopyflakes
from cms.tests.widgets import * # nopyflakes
6 changes: 3 additions & 3 deletions cms/tests/admin.py → cms/tests/test_admin.py
Expand Up @@ -46,9 +46,9 @@ def admin_class(self):
return site._registry[Page]

def _get_guys(self, admin_only=False, use_global_permissions=True):
admiN_user = self.get_superuser()
admin_user = self.get_superuser()
if admin_only:
return admiN_user
return admin_user
USERNAME = 'test'

if get_user_model().USERNAME_FIELD == 'email':
Expand All @@ -73,7 +73,7 @@ def _get_guys(self, admin_only=False, use_global_permissions=True):
can_move_page=True,
)
gpp.sites = Site.objects.all()
return admiN_user, normal_guy
return admin_user, normal_guy


class AdminTestCase(AdminTestsBase):
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion cms/tests/api.py → cms/tests/test_api.py
Expand Up @@ -18,7 +18,7 @@
from cms.test_utils.util.context_managers import SettingsOverride
from cms.test_utils.util.menu_extender import TestMenu
from cms.test_utils.util.mock import AttributeObject
from cms.tests.apphooks import APP_MODULE, APP_NAME
from cms.tests.test_apphooks import APP_MODULE, APP_NAME
from cms.utils.compat.dj import get_user_model


Expand Down
2 changes: 1 addition & 1 deletion cms/tests/apphooks.py → cms/tests/test_apphooks.py
Expand Up @@ -15,7 +15,7 @@
from cms.test_utils.project.placeholderapp.models import Example1
from cms.test_utils.testcases import CMSTestCase, SettingsOverrideTestCase
from cms.test_utils.util.context_managers import SettingsOverride
from cms.tests.menu_utils import DumbPageLanguageUrl
from cms.tests.test_menu_utils import DumbPageLanguageUrl
from cms.toolbar.toolbar import CMSToolbar
from cms.utils.compat.dj import get_user_model
from cms.utils.conf import get_cms_setting
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion cms/tests/extensions.py → cms/tests/test_extensions.py
Expand Up @@ -14,7 +14,7 @@
from cms.test_utils.project.extensionapp.models import (MyPageExtension,
MyTitleExtension)
from cms.test_utils.testcases import SettingsOverrideTestCase as TestCase
from cms.tests import AdminTestsBase
from cms.tests.test_admin import AdminTestsBase
from cms.utils.compat.dj import get_user_model


Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import with_statement

from cms.tests.menu_page_viewperm import ViewPermissionTests
from cms.tests.test_menu_page_viewperm import ViewPermissionTests
from cms.utils.compat.dj import get_user_model

__all__ = [
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -9,7 +9,7 @@
from cms.models import Page
from cms.models.placeholdermodel import Placeholder
from cms.models.pluginmodel import CMSPlugin
from cms.tests.plugins import PluginsTestBaseCase
from cms.tests.test_plugins import PluginsTestBaseCase
from cms.test_utils.util.context_managers import SettingsOverride
from cms.utils.copy_plugins import copy_plugins_to
from cms.utils.compat.tests import UnittestCompatMixin
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions cms/tests/rendering.py → cms/tests/test_rendering.py
Expand Up @@ -160,8 +160,8 @@ def test_processors(self):
can be defined in settings and are working and that extra plugin context processors can be passed to PluginContext.
"""
with SettingsOverride(
CMS_PLUGIN_PROCESSORS=('cms.tests.rendering.sample_plugin_processor',),
CMS_PLUGIN_CONTEXT_PROCESSORS=('cms.tests.rendering.sample_plugin_context_processor',),
CMS_PLUGIN_PROCESSORS=('cms.tests.test_rendering.sample_plugin_processor',),
CMS_PLUGIN_CONTEXT_PROCESSORS=('cms.tests.test_rendering.sample_plugin_context_processor',),
):
def test_passed_plugin_context_processor(instance, placeholder, context):
return {'test_passed_plugin_context_processor': 'test_passed_plugin_context_processor_ok'}
Expand Down Expand Up @@ -420,4 +420,4 @@ def test_render_placeholder_toolbar(self):
]
output = render_placeholder_toolbar(placeholder, context, 'test', 'en')
for cls in classes:
self.assertTrue(cls in output, '%r is not in %r' % (cls, output))
self.assertTrue(cls in output, '%r is not in %r' % (cls, output))
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -5,7 +5,7 @@
from cms.api import add_plugin
from cms.constants import PLUGIN_MOVE_ACTION, PLUGIN_COPY_ACTION
from cms.models import StaticPlaceholder, Placeholder, CMSPlugin
from cms.tests.plugins import PluginsTestBaseCase
from cms.tests.test_plugins import PluginsTestBaseCase
from cms.utils.compat.dj import force_unicode
from cms.utils.urlutils import admin_reverse
from django.contrib.admin.sites import site
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
41 changes: 21 additions & 20 deletions cms/tests/toolbar_pool.py → cms/tests/test_toolbar_pool.py
Expand Up @@ -15,47 +15,48 @@ class TestToolbar(CMSToolbar):


class ToolbarPoolTests(CMSTestCase):

def setUp(self):
self.pool = ToolbarPool()

def test_register(self):
self.pool.register(TestToolbar)
self.pool.register(CMSToolbar)
self.assertEqual(self.pool.toolbars, {
pool = ToolbarPool()
pool.register(TestToolbar)
pool.register(CMSToolbar)
self.assertEqual(pool.toolbars, {
'cms.toolbar_base.CMSToolbar': CMSToolbar,
'cms.tests.toolbar_pool.TestToolbar': TestToolbar})
'cms.tests.test_toolbar_pool.TestToolbar': TestToolbar})

self.assertRaises(ToolbarAlreadyRegistered,
self.pool.register, TestToolbar)
pool.register, TestToolbar)

def test_register_type(self):
self.assertRaises(ImproperlyConfigured, self.pool.register, str)
self.assertRaises(ImproperlyConfigured, self.pool.register, object)
pool = ToolbarPool()
self.assertRaises(ImproperlyConfigured, pool.register, str)
self.assertRaises(ImproperlyConfigured, pool.register, object)

def test_register_order(self):
self.pool.register(TestToolbar)
self.pool.register(CMSToolbar)
pool = ToolbarPool()
pool.register(TestToolbar)
pool.register(CMSToolbar)

test_toolbar = SortedDict()
test_toolbar['cms.tests.toolbar_pool.TestToolbar'] = TestToolbar
test_toolbar['cms.tests.test_toolbar_pool.TestToolbar'] = TestToolbar
test_toolbar['cms.toolbar_base.CMSToolbar'] = CMSToolbar
self.assertEqual(list(test_toolbar.keys()), list(self.pool.toolbars.keys()))
self.assertEqual(list(test_toolbar.keys()), list(pool.toolbars.keys()))

def test_unregister(self):
self.pool.register(TestToolbar)
self.pool.unregister(TestToolbar)
self.assertEqual(self.pool.toolbars, {})
pool = ToolbarPool()
pool.register(TestToolbar)
pool.unregister(TestToolbar)
self.assertEqual(pool.toolbars, {})

self.assertRaises(ToolbarNotRegistered,
self.pool.unregister, TestToolbar)
pool.unregister, TestToolbar)

def test_settings(self):
pool = ToolbarPool()
toolbars = toolbar_pool.toolbars
toolbar_pool.clear()
with SettingsOverride(CMS_TOOLBARS=['cms.cms_toolbar.BasicToolbar', 'cms.cms_toolbar.PlaceholderToolbar']):
toolbar_pool.register(TestToolbar)
self.assertEqual(len(list(self.pool.get_toolbars().keys())), 2)
self.assertEqual(len(list(pool.get_toolbars().keys())), 2)
api.create_page("home", "simple.html", "en", published=True)
with self.login_user_context(self.get_superuser()):
response = self.client.get("/en/?%s" % get_cms_setting('CMS_TOOLBAR_URL__EDIT_ON'))
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.