Moved a GoogleMap test

This commit is contained in:
Claude Paroz 2014-02-03 16:22:10 +01:00
parent e7e3435b4d
commit 6e0f1bc06d
2 changed files with 13 additions and 15 deletions

View File

@ -4,7 +4,7 @@ from unittest import skipUnless
from django.contrib.gis.geos import HAS_GEOS from django.contrib.gis.geos import HAS_GEOS
from django.contrib.gis.tests.utils import HAS_SPATIAL_DB from django.contrib.gis.tests.utils import HAS_SPATIAL_DB
from django.test import TestCase, override_settings from django.test import TestCase
if HAS_GEOS and HAS_SPATIAL_DB: if HAS_GEOS and HAS_SPATIAL_DB:
from django.contrib.gis import admin from django.contrib.gis import admin
@ -12,8 +12,6 @@ if HAS_GEOS and HAS_SPATIAL_DB:
from .models import City from .models import City
GOOGLE_MAPS_API_KEY = 'XXXX'
@skipUnless(HAS_GEOS and HAS_SPATIAL_DB, "Geos and spatial db are required.") @skipUnless(HAS_GEOS and HAS_SPATIAL_DB, "Geos and spatial db are required.")
class GeoAdminTest(TestCase): class GeoAdminTest(TestCase):
@ -59,15 +57,3 @@ class GeoAdminTest(TestCase):
self.assertFalse(has_changed(initial, data_same)) self.assertFalse(has_changed(initial, data_same))
self.assertFalse(has_changed(initial, data_almost_same)) self.assertFalse(has_changed(initial, data_almost_same))
self.assertTrue(has_changed(initial, data_changed)) self.assertTrue(has_changed(initial, data_changed))
@override_settings(GOOGLE_MAPS_API_KEY=GOOGLE_MAPS_API_KEY)
def test_google_map_scripts(self):
"""
Testing GoogleMap.scripts() output. See #20773.
"""
from django.contrib.gis.maps.google.gmap import GoogleMap
google_map = GoogleMap()
scripts = google_map.scripts
self.assertIn(GOOGLE_MAPS_API_KEY, scripts)
self.assertIn("new GMap2", scripts)

View File

@ -13,6 +13,18 @@ GOOGLE_MAPS_API_KEY = 'XXXX'
@skipUnless(HAS_GEOS, 'Geos is required.') @skipUnless(HAS_GEOS, 'Geos is required.')
class GoogleMapsTest(TestCase): class GoogleMapsTest(TestCase):
@override_settings(GOOGLE_MAPS_API_KEY=GOOGLE_MAPS_API_KEY)
def test_google_map_scripts(self):
"""
Testing GoogleMap.scripts() output. See #20773.
"""
from django.contrib.gis.maps.google.gmap import GoogleMap
google_map = GoogleMap()
scripts = google_map.scripts
self.assertIn(GOOGLE_MAPS_API_KEY, scripts)
self.assertIn("new GMap2", scripts)
@override_settings(GOOGLE_MAPS_API_KEY=GOOGLE_MAPS_API_KEY) @override_settings(GOOGLE_MAPS_API_KEY=GOOGLE_MAPS_API_KEY)
def test_unicode_in_google_maps(self): def test_unicode_in_google_maps(self):
""" """