Commit 6e0f1bc0 authored by Claude Paroz's avatar Claude Paroz
Browse files

Moved a GoogleMap test

parent e7e3435b
Loading
Loading
Loading
Loading
+1 −15
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@ from unittest import skipUnless

from django.contrib.gis.geos import HAS_GEOS
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:
    from django.contrib.gis import admin
@@ -12,8 +12,6 @@ if HAS_GEOS and HAS_SPATIAL_DB:

    from .models import City

GOOGLE_MAPS_API_KEY = 'XXXX'


@skipUnless(HAS_GEOS and HAS_SPATIAL_DB, "Geos and spatial db are required.")
class GeoAdminTest(TestCase):
@@ -59,15 +57,3 @@ class GeoAdminTest(TestCase):
        self.assertFalse(has_changed(initial, data_same))
        self.assertFalse(has_changed(initial, data_almost_same))
        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)
+12 −0
Original line number Diff line number Diff line
@@ -13,6 +13,18 @@ GOOGLE_MAPS_API_KEY = 'XXXX'
@skipUnless(HAS_GEOS, 'Geos is required.')
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)
    def test_unicode_in_google_maps(self):
        """