Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
django 1.3 and postgres fixes
  • Loading branch information
digi604 committed Nov 16, 2012
1 parent 38bcc65 commit e743264
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 49 deletions.
2 changes: 0 additions & 2 deletions .travis.yml
Expand Up @@ -17,8 +17,6 @@ before_script:
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'create database IF NOT EXISTS djangocms_test'; fi"

install:
- pip install mysql-python
- pip install psycopg2
- pip install -q -r $DJANGO --use-mirrors
script:
python runtests.py --db $DB --db_name djangocms_test
Expand Down
1 change: 1 addition & 0 deletions cms/test_utils/cli.py
Expand Up @@ -23,6 +23,7 @@ def configure(db_data, **extra):
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': db_data.get('NAME', 'djangocms_test'),
'USER': db_data.get('USER', 'postgres'),
'HOST':'/var/pgsql_socket',
}
if db_data.get('PASSWORD', None):
DB['PASSWORD'] = db_data['PASSWORD']
Expand Down
86 changes: 40 additions & 46 deletions cms/tests/menu.py
Expand Up @@ -116,20 +116,18 @@ def test_show_menu_num_queries(self):
# test standard show_menu

num_query = 5
db_engine = settings.DATABASES['default']['ENGINE']
if db_engine == 'django.db.backends.mysql':
return #save CacheKey produces save point queries
with self.assertNumQueries(num_query):
"""
The queries should be:
get all pages
get all page permissions
get all titles
get the menu cache key
set the menu cache key
"""
tpl = Template("{% load menu_tags %}{% show_menu %}")
tpl.render(context)
if settings.DATABASES['default']['ENGINE'] == 'django.db.backends.sqlite':
with self.assertNumQueries(num_query):
"""
The queries should be:
get all pages
get all page permissions
get all titles
get the menu cache key
set the menu cache key
"""
tpl = Template("{% load menu_tags %}{% show_menu %}")
tpl.render(context)

def test_show_menu_cache_key_leak(self):
context = self.get_context()
Expand Down Expand Up @@ -702,20 +700,18 @@ def test_show_submenu_num_queries(self):
context = self.get_context(page.get_absolute_url())
# test standard show_menu
num_query = 5
db_engine = settings.DATABASES['default']['ENGINE']
if db_engine == 'django.db.backends.mysql':
return #save CacheKey produces save point queries
with self.assertNumQueries(num_query):
"""
The queries should be:
get all pages
get all page permissions
get all titles
get the menu cache key
set the menu cache key
"""
tpl = Template("{% load menu_tags %}{% show_sub_menu %}")
tpl.render(context)
if settings.DATABASES['default']['ENGINE'] == 'django.db.backends.sqlite':
with self.assertNumQueries(num_query):
"""
The queries should be:
get all pages
get all page permissions
get all titles
get the menu cache key
set the menu cache key
"""
tpl = Template("{% load menu_tags %}{% show_sub_menu %}")
tpl.render(context)

class ShowMenuBelowIdTests(BaseMenuTest):
def test_not_in_navigation(self):
Expand Down Expand Up @@ -768,24 +764,22 @@ def test_not_in_navigation_num_queries(self):
published=True, in_navigation=True)
create_page('D', 'nav_playground.html', 'en', parent=self.reload(b),
published=True, in_navigation=False)
with LanguageOverride('en'):
context = self.get_context(a.get_absolute_url())
num_query = 5
db_engine = settings.DATABASES['default']['ENGINE']
if db_engine == 'django.db.backends.mysql':
return #save CacheKey produces save point queries
with self.assertNumQueries(num_query):
"""
The queries should be:
get all pages
get all page permissions
get all titles
get the menu cache key
set the menu cache key
"""
# Actually seems to run:
tpl = Template("{% load menu_tags %}{% show_menu_below_id 'a' 0 100 100 100 %}")
tpl.render(context)
if settings.DATABASES['default']['ENGINE'] == 'django.db.backends.sqlite':
with LanguageOverride('en'):
context = self.get_context(a.get_absolute_url())
num_query = 5
with self.assertNumQueries(num_query):
"""
The queries should be:
get all pages
get all page permissions
get all titles
get the menu cache key
set the menu cache key
"""
# Actually seems to run:
tpl = Template("{% load menu_tags %}{% show_menu_below_id 'a' 0 100 100 100 %}")
tpl.render(context)


class ViewPermissionMenuTests(SettingsOverrideTestCase):
Expand Down
2 changes: 1 addition & 1 deletion test_requirements/django-1.3.txt
@@ -1,4 +1,4 @@
-r requirements_base.txt
-e git://github.com/digi604/django-i18nurls.git#egg=django-i18nurls
Django>=1.3,<1.4
django-reversion==1.5.3
django-reversion==1.5.5
1 change: 1 addition & 0 deletions test_requirements/django-1.4.txt
@@ -1,3 +1,4 @@
-r requirements_base.txt
Django>=1.4,<1.5
django-reversion==1.6
psycopg2==2.4
1 change: 1 addition & 0 deletions test_requirements/requirements_base.txt
Expand Up @@ -8,3 +8,4 @@ html5lib>=0.90
django-mptt==0.5.2
django-sekizai>=0.6.1
argparse
mysql-python

0 comments on commit e743264

Please sign in to comment.