2016-12-10 19:05:45 +01:00
|
|
|
# -*- coding: utf-8 -*-
|
2014-12-02 12:55:20 +01:00
|
|
|
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
|
|
|
|
# this repository contains the full copyright notices and license terms.
|
2021-12-11 17:58:42 +01:00
|
|
|
|
2016-08-19 21:25:16 +02:00
|
|
|
from trytond.pool import Pool
|
2021-12-11 17:58:42 +01:00
|
|
|
from trytond.tests.test_tryton import ModuleTestCase, with_transaction
|
2009-06-26 16:17:56 +02:00
|
|
|
|
|
|
|
|
|
2015-01-27 18:13:34 +01:00
|
|
|
class GoogleMapsTestCase(ModuleTestCase):
|
2014-01-12 19:59:45 +01:00
|
|
|
'Test GoogleMaps module'
|
2015-01-27 18:13:34 +01:00
|
|
|
module = 'google_maps'
|
2015-01-02 16:08:02 +01:00
|
|
|
|
2016-08-19 21:25:16 +02:00
|
|
|
@with_transaction()
|
|
|
|
|
def test_google_maps_url(self):
|
|
|
|
|
"Test Google Maps URL"
|
|
|
|
|
pool = Pool()
|
|
|
|
|
Address = pool.get('party.address')
|
2016-09-06 10:08:22 +02:00
|
|
|
Party = pool.get('party.party')
|
|
|
|
|
party = Party()
|
|
|
|
|
party.save()
|
2016-08-19 21:25:16 +02:00
|
|
|
address = Address()
|
2016-09-06 10:08:22 +02:00
|
|
|
address.party = party
|
2016-08-19 21:25:16 +02:00
|
|
|
address.street = "300 Cliff Street"
|
2021-03-31 23:59:33 +02:00
|
|
|
address.postal_code = "18503"
|
2016-08-19 21:25:16 +02:00
|
|
|
address.city = "Scranton"
|
2016-09-06 10:08:22 +02:00
|
|
|
address.save()
|
2016-08-19 21:25:16 +02:00
|
|
|
|
|
|
|
|
self.assertEqual(
|
|
|
|
|
address.on_change_with_google_maps_url(),
|
|
|
|
|
'http://maps.google.com/maps?hl=en&'
|
|
|
|
|
'q=300%20Cliff%20Street%2018503%20Scranton')
|
|
|
|
|
|
2016-12-10 19:05:45 +01:00
|
|
|
address = Address()
|
|
|
|
|
address.party = party
|
2018-06-26 19:11:47 +02:00
|
|
|
address.street = "Dépôt Street"
|
2021-03-31 23:59:33 +02:00
|
|
|
address.postal_code = "18503"
|
2016-12-10 19:05:45 +01:00
|
|
|
address.city = "Scranton"
|
|
|
|
|
address.save()
|
|
|
|
|
|
|
|
|
|
self.assertEqual(
|
|
|
|
|
address.on_change_with_google_maps_url(),
|
|
|
|
|
'http://maps.google.com/maps?hl=en&'
|
|
|
|
|
'q=D%C3%A9p%C3%B4t%20Street%2018503%20Scranton')
|
|
|
|
|
|
2012-04-03 20:07:04 +02:00
|
|
|
|
2022-04-16 18:30:17 +02:00
|
|
|
del ModuleTestCase
|