File: test_module.py

package info (click to toggle)
tryton-modules-google-maps 7.0.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 348 kB
  • sloc: python: 237; xml: 22; makefile: 11; sh: 3
file content (46 lines) | stat: -rw-r--r-- 1,405 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# -*- coding: utf-8 -*-
# This file is part of Tryton.  The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.

from trytond.pool import Pool
from trytond.tests.test_tryton import ModuleTestCase, with_transaction


class GoogleMapsTestCase(ModuleTestCase):
    'Test GoogleMaps module'
    module = 'google_maps'

    @with_transaction()
    def test_google_maps_url(self):
        "Test Google Maps URL"
        pool = Pool()
        Address = pool.get('party.address')
        Party = pool.get('party.party')
        party = Party()
        party.save()
        address = Address()
        address.party = party
        address.street = "300 Cliff Street"
        address.postal_code = "18503"
        address.city = "Scranton"
        address.save()

        self.assertEqual(
            address.on_change_with_google_maps_url(),
            'http://maps.google.com/maps?hl=en&'
            'q=300%20Cliff%20Street%2018503%20Scranton')

        address = Address()
        address.party = party
        address.street = "Dépôt Street"
        address.postal_code = "18503"
        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')


del ModuleTestCase