Browse Source

[FIX] partner_external_map: Resilient coordinate test

As coordinates in partner are float, they are affected by the rounding problem we
all know, so sometimes (depending on the Python interpreter used) the generated URL
contains extra digits. Example:

39.158370000000005 instead of 39.15837

so with this change on the test, we make it resilient to this problem.
12.0
Pedro M. Baeza 4 years ago
parent
commit
1e99e5cde5
  1. 2
      partner_external_map/__manifest__.py
  2. 7
      partner_external_map/tests/test_partner_external_map.py

2
partner_external_map/__manifest__.py

@ -5,7 +5,7 @@
{ {
'name': 'Partner External Maps', 'name': 'Partner External Maps',
'version': '12.0.1.0.0',
'version': '12.0.1.0.1',
'category': 'Extra Tools', 'category': 'Extra Tools',
'license': 'AGPL-3', 'license': 'AGPL-3',
'summary': 'Add Map and Map Routing buttons on partner form to ' 'summary': 'Add Map and Map Routing buttons on partner form to '

7
partner_external_map/tests/test_partner_external_map.py

@ -60,9 +60,10 @@ class TestPartnerExternalMap(common.TransactionCase):
partner.partner_latitude = 39.15837 partner.partner_latitude = 39.15837
partner.partner_longitude = -3.02145 partner.partner_longitude = -3.02145
action = partner.open_map() action = partner.open_map()
self.assertEqual(
action['url'],
"https://www.google.com/maps?z=15&q=39.15837,-3.02145")
self.assertTrue(
action["url"].startswith("https://www.google.com/maps?z="))
self.assertIn("39.15837", action['url'])
self.assertIn("-3.02145", action['url'])
def test_exception_no_addr(self): def test_exception_no_addr(self):
self.partner.write({ self.partner.write({

Loading…
Cancel
Save