Reuse existing addresses when creating an event

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2019-08-22 15:57:44 +02:00
parent ebf5534003
commit 0e0b68445b
22 changed files with 410 additions and 121 deletions

View File

@@ -43,7 +43,7 @@ defmodule Mobilizon.Service.Geospatial.GoogleMapsTest do
use_cassette "geospatial/google_maps/search" do
assert %Address{
locality: "Lyon",
description: "10 Rue Jangot, 69007 Lyon, France",
description: "10 Rue Jangot",
region: "Auvergne-Rhône-Alpes",
country: "France",
postal_code: "69007",
@@ -52,8 +52,13 @@ defmodule Mobilizon.Service.Geospatial.GoogleMapsTest do
coordinates: {4.8424032, 45.75164940000001},
properties: %{},
srid: 4326
}
} == GoogleMaps.search("10 rue Jangot", api_key: "toto") |> hd
},
origin_id: "gm:ChIJtW0QikTq9EcRLI4Vy6bRx0U"
} ==
GoogleMaps.search("10 rue Jangot",
api_key: "toto"
)
|> hd
end
end
@@ -61,16 +66,17 @@ defmodule Mobilizon.Service.Geospatial.GoogleMapsTest do
use_cassette "geospatial/google_maps/geocode" do
assert %Address{
locality: "Lyon",
description: "10 Rue Jangot, 69007 Lyon, France",
description: "10bis Rue Jangot",
region: "Auvergne-Rhône-Alpes",
country: "France",
postal_code: "69007",
street: "10 Rue Jangot",
street: "10bis Rue Jangot",
geom: %Geo.Point{
coordinates: {4.8424967, 45.751725},
coordinates: {4.8424966, 45.751725},
properties: %{},
srid: 4326
}
},
origin_id: "gm:ChIJrW0QikTq9EcR96jk2OnO75w"
} ==
GoogleMaps.geocode(4.842569, 45.751718, api_key: "toto")
|> hd

View File

@@ -39,7 +39,8 @@ defmodule Mobilizon.Service.Geospatial.NominatimTest do
coordinates: {4.8425657, 45.7517141},
properties: %{},
srid: 4326
}
},
origin_id: "osm:3078260611"
} == Nominatim.search("10 rue Jangot") |> hd
end
end
@@ -58,7 +59,8 @@ defmodule Mobilizon.Service.Geospatial.NominatimTest do
coordinates: {4.8425657, 45.7517141},
properties: %{},
srid: 4326
}
},
origin_id: "osm:3078260611"
} ==
Nominatim.geocode(4.842569, 45.751718)
|> hd