Exemplo n.º 1
0
 def testMapRegion(self):
     """Verifies that the 'region' property affects the Maps API URL."""
     m1 = test_utils.CreateMap({'title': 'no region'})
     m2 = test_utils.CreateMap({'title': 'has region', 'region': 'in'})
     with test_utils.RootLogin():
         cm_config = maps.GetConfig(
             test_utils.SetupRequest('/.maps/' + m1.id), m1)
         self.assertTrue('region=' not in cm_config['maps_api_url'])
         cm_config = maps.GetConfig(
             test_utils.SetupRequest('/.maps/' + m2.id), m2)
         self.assertTrue('region=in' in cm_config['maps_api_url'])
Exemplo n.º 2
0
    def testMapsApiUrlI18n(self):
        """Verifies that language and region are set correctly for the Maps API."""
        cm_config = maps.GetConfig(test_utils.SetupRequest('/'))
        self.assertTrue('language=en' in cm_config['maps_api_url'])
        self.assertFalse('region=' in cm_config['maps_api_url'])

        cm_config = maps.GetConfig(test_utils.SetupRequest('/?hl=ja', 'ja'))
        self.assertTrue('language=ja' in cm_config['maps_api_url'])
        self.assertFalse('region=' in cm_config['maps_api_url'])

        cm_config = maps.GetConfig(
            test_utils.SetupRequest('/?hl=th&gl=IN', 'th'))
        self.assertTrue('language=th' in cm_config['maps_api_url'])
        self.assertTrue('region=IN' in cm_config['maps_api_url'])
Exemplo n.º 3
0
 def testMapIdInConfig_DraftMap(self):
     """Verifies the map ID is added to the map_root always."""
     with test_utils.RootLogin():
         my_map = test_utils.CreateMap()
         cfg = maps.GetConfig(
             test_utils.SetupRequest('/.maps/' + my_map.id), my_map)
     self.assertEqual(my_map.id, cfg['map_root']['id'])
Exemplo n.º 4
0
 def testMapIdInConfig_PublishedMap(self):
     with test_utils.RootLogin():
         my_map = test_utils.CreateMap()
         my_entry = model.CatalogEntry.Create(test_utils.PRIMARY_DOMAIN,
                                              'label', my_map)
         cfg = maps.GetConfig(test_utils.SetupRequest(
             '/a/%s/label' % test_utils.PRIMARY_DOMAIN),
                              catalog_entry=my_entry)
     self.assertEqual(my_map.id, cfg['map_root']['id'])
Exemplo n.º 5
0
 def testClientConfigOverride(self):
     """Verifies that query parameters can override client config settings."""
     cm_config = maps.GetConfig(
         test_utils.SetupRequest('/?dev=1&show_login=1'))
     self.assertEquals(True, cm_config['show_login'])