From 97c7bc8208565cc14b201ae0b3271793a1fd9001 Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Wed, 8 Jul 2020 17:22:15 +0200 Subject: [PATCH] [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. --- partner_external_map/__manifest__.py | 2 +- partner_external_map/tests/test_partner_external_map.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/partner_external_map/__manifest__.py b/partner_external_map/__manifest__.py index b1db59de9..acf220ddb 100644 --- a/partner_external_map/__manifest__.py +++ b/partner_external_map/__manifest__.py @@ -5,7 +5,7 @@ { 'name': 'Partner External Maps', - 'version': '12.0.1.0.0', + 'version': '12.0.1.0.1', 'category': 'Extra Tools', 'license': 'AGPL-3', 'summary': 'Add Map and Map Routing buttons on partner form to ' diff --git a/partner_external_map/tests/test_partner_external_map.py b/partner_external_map/tests/test_partner_external_map.py index b2e6d10cd..3918c04e8 100644 --- a/partner_external_map/tests/test_partner_external_map.py +++ b/partner_external_map/tests/test_partner_external_map.py @@ -60,9 +60,10 @@ class TestPartnerExternalMap(common.TransactionCase): partner.partner_latitude = 39.15837 partner.partner_longitude = -3.02145 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): self.partner.write({