Skip `LayerMapRouterTest` if there are not multiple databases.

This commit is contained in:
Justin Bronn 2012-10-05 15:26:33 -07:00
parent c1b06c8137
commit 1c010ce41d
1 changed files with 3 additions and 0 deletions

View File

@ -1,6 +1,7 @@
from __future__ import absolute_import from __future__ import absolute_import
import os import os
import unittest
from copy import copy from copy import copy
from decimal import Decimal from decimal import Decimal
@ -9,6 +10,7 @@ from django.contrib.gis.tests.utils import mysql
from django.contrib.gis.utils.layermapping import (LayerMapping, LayerMapError, from django.contrib.gis.utils.layermapping import (LayerMapping, LayerMapError,
InvalidDecimal, MissingForeignKey) InvalidDecimal, MissingForeignKey)
from django.db import router from django.db import router
from django.conf import settings
from django.test import TestCase from django.test import TestCase
from .models import ( from .models import (
@ -308,6 +310,7 @@ class LayerMapRouterTest(TestCase):
def tearDown(self): def tearDown(self):
router.routers = self.old_routers router.routers = self.old_routers
@unittest.skipUnless(len(settings.DATABASES) > 1, 'multiple databases required')
def test_layermapping_default_db(self): def test_layermapping_default_db(self):
lm = LayerMapping(City, city_shp, city_mapping) lm = LayerMapping(City, city_shp, city_mapping)
self.assertEqual(lm.using, 'other') self.assertEqual(lm.using, 'other')