1
0
mirror of https://github.com/django/django.git synced 2024-12-25 02:26:12 +00:00

Fixed #18318 -- Changed some tests to be 3rd party DB friendly

Thanks to manfre for report and patch.
This commit is contained in:
Anssi Kääriäinen 2012-05-22 23:30:24 +03:00
parent 459c3b67b7
commit 8ee1a664f9

View File

@ -13,13 +13,12 @@ import sys
from django import conf, bin, get_version from django import conf, bin, get_version
from django.conf import settings from django.conf import settings
from django.db import connection
from django.test.simple import DjangoTestSuiteRunner from django.test.simple import DjangoTestSuiteRunner
from django.utils import unittest from django.utils import unittest
from django.test import LiveServerTestCase from django.test import LiveServerTestCase
test_dir = os.path.dirname(os.path.dirname(__file__)) test_dir = os.path.dirname(os.path.dirname(__file__))
expected_query_re = re.compile(r'CREATE TABLE [`"]admin_scripts_article[`"]', re.IGNORECASE)
class AdminScriptTestCase(unittest.TestCase): class AdminScriptTestCase(unittest.TestCase):
def write_settings(self, filename, apps=None, is_dir=False, sdict=None): def write_settings(self, filename, apps=None, is_dir=False, sdict=None):
@ -859,14 +858,18 @@ class ManageAlternateSettings(AdminScriptTestCase):
"alternate: manage.py builtin commands work with settings provided as argument" "alternate: manage.py builtin commands work with settings provided as argument"
args = ['sqlall', '--settings=alternate_settings', 'admin_scripts'] args = ['sqlall', '--settings=alternate_settings', 'admin_scripts']
out, err = self.run_manage(args) out, err = self.run_manage(args)
self.assertRegexpMatches(out, expected_query_re) expected = ('create table %s'
% connection.ops.quote_name('admin_scripts_article'))
self.assertTrue(expected.lower() in out.lower())
self.assertNoOutput(err) self.assertNoOutput(err)
def test_builtin_with_environment(self): def test_builtin_with_environment(self):
"alternate: manage.py builtin commands work if settings are provided in the environment" "alternate: manage.py builtin commands work if settings are provided in the environment"
args = ['sqlall', 'admin_scripts'] args = ['sqlall', 'admin_scripts']
out, err = self.run_manage(args, 'alternate_settings') out, err = self.run_manage(args, 'alternate_settings')
self.assertRegexpMatches(out, expected_query_re) expected = ('create table %s'
% connection.ops.quote_name('admin_scripts_article'))
self.assertTrue(expected.lower() in out.lower())
self.assertNoOutput(err) self.assertNoOutput(err)
def test_builtin_with_bad_settings(self): def test_builtin_with_bad_settings(self):