Fix backend tests

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2021-10-12 08:49:12 +02:00
parent 9621caf661
commit b383d11f51
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773
7 changed files with 13 additions and 2 deletions

View File

@ -496,7 +496,7 @@ defmodule Mobilizon.GraphQL.Resolvers.Event do
physical_address when is_map(physical_address) -> physical_address when is_map(physical_address) ->
TimezoneDetector.detect( TimezoneDetector.detect(
timezone, timezone,
physical_address.geom, Map.get(physical_address, :geom),
fallback_tz fallback_tz
) )

View File

@ -8,7 +8,9 @@ defmodule Mobilizon.Service.TimezoneDetector do
@doc """ @doc """
Detect the most appropriate timezone from a value, a geographic set of coordinates and a fallback Detect the most appropriate timezone from a value, a geographic set of coordinates and a fallback
""" """
@spec detect(String.t() | nil, detectable(), String.t()) :: String.t() @spec detect(String.t() | nil, detectable() | nil, String.t()) :: String.t()
def detect(tz, nil, fallback), do: detect(tz, fallback)
def detect(nil, geo, fallback) do def detect(nil, geo, fallback) do
case TzWorld.timezone_at(geo) do case TzWorld.timezone_at(geo) do
{:ok, timezone} -> {:ok, timezone} ->

View File

@ -28,6 +28,7 @@ defmodule Mobilizon.Service.Geospatial.AddokTest do
region: "69, Rhône, Auvergne-Rhône-Alpes", region: "69, Rhône, Auvergne-Rhône-Alpes",
locality: "Lyon", locality: "Lyon",
description: "10 Rue Jangot", description: "10 Rue Jangot",
timezone: "Europe/Paris",
postal_code: "69007", postal_code: "69007",
street: "10 Rue Jangot", street: "10 Rue Jangot",
geom: %Geo.Point{coordinates: {4.842569, 45.751718}, properties: %{}, srid: 4326} geom: %Geo.Point{coordinates: {4.842569, 45.751718}, properties: %{}, srid: 4326}
@ -54,6 +55,7 @@ defmodule Mobilizon.Service.Geospatial.AddokTest do
region: "69, Rhône, Auvergne-Rhône-Alpes", region: "69, Rhône, Auvergne-Rhône-Alpes",
locality: "Lyon", locality: "Lyon",
description: "10 Rue Jangot", description: "10 Rue Jangot",
timezone: "Europe/Paris",
postal_code: "69007", postal_code: "69007",
street: "10 Rue Jangot", street: "10 Rue Jangot",
geom: %Geo.Point{coordinates: {4.842569, 45.751718}, properties: %{}, srid: 4326} geom: %Geo.Point{coordinates: {4.842569, 45.751718}, properties: %{}, srid: 4326}

View File

@ -69,6 +69,7 @@ defmodule Mobilizon.Service.Geospatial.GoogleMapsTest do
country: "France", country: "France",
postal_code: "69007", postal_code: "69007",
street: "10 Rue Jangot", street: "10 Rue Jangot",
timezone: "Europe/Paris",
geom: %Geo.Point{ geom: %Geo.Point{
coordinates: {4.8424032, 45.75164940000001}, coordinates: {4.8424032, 45.75164940000001},
properties: %{}, properties: %{},
@ -116,6 +117,7 @@ defmodule Mobilizon.Service.Geospatial.GoogleMapsTest do
country: "France", country: "France",
postal_code: "69007", postal_code: "69007",
street: "10bis Rue Jangot", street: "10bis Rue Jangot",
timezone: "Europe/Paris",
geom: %Geo.Point{ geom: %Geo.Point{
coordinates: {4.8424966, 45.751725}, coordinates: {4.8424966, 45.751725},
properties: %{}, properties: %{},

View File

@ -55,6 +55,7 @@ defmodule Mobilizon.Service.Geospatial.MapQuestTest do
country: "FR", country: "FR",
postal_code: "69007", postal_code: "69007",
street: "10 Rue Jangot", street: "10 Rue Jangot",
timezone: "Europe/Paris",
geom: %Geo.Point{ geom: %Geo.Point{
coordinates: {4.842566, 45.751714}, coordinates: {4.842566, 45.751714},
properties: %{}, properties: %{},
@ -88,6 +89,7 @@ defmodule Mobilizon.Service.Geospatial.MapQuestTest do
country: "FR", country: "FR",
postal_code: "69007", postal_code: "69007",
street: "10 Rue Jangot", street: "10 Rue Jangot",
timezone: "Europe/Paris",
geom: %Geo.Point{ geom: %Geo.Point{
coordinates: {4.842569, 45.751718}, coordinates: {4.842569, 45.751718},
properties: %{}, properties: %{},

View File

@ -31,6 +31,7 @@ defmodule Mobilizon.Service.Geospatial.NominatimTest do
country: "France", country: "France",
postal_code: "69007", postal_code: "69007",
street: "10 Rue Jangot", street: "10 Rue Jangot",
timezone: "Europe/Paris",
geom: %Geo.Point{ geom: %Geo.Point{
coordinates: {4.8425657, 45.7517141}, coordinates: {4.8425657, 45.7517141},
properties: %{}, properties: %{},
@ -66,6 +67,7 @@ defmodule Mobilizon.Service.Geospatial.NominatimTest do
country: "France", country: "France",
postal_code: "69007", postal_code: "69007",
street: "10 Rue Jangot", street: "10 Rue Jangot",
timezone: "Europe/Paris",
geom: %Geo.Point{ geom: %Geo.Point{
coordinates: {4.8425657, 45.7517141}, coordinates: {4.8425657, 45.7517141},
properties: %{}, properties: %{},

View File

@ -30,6 +30,7 @@ defmodule Mobilizon.Service.Geospatial.PhotonTest do
country: "France", country: "France",
postal_code: "69007", postal_code: "69007",
street: "10 Rue Jangot", street: "10 Rue Jangot",
timezone: "Europe/Paris",
geom: %Geo.Point{ geom: %Geo.Point{
coordinates: {4.8425657, 45.7517141}, coordinates: {4.8425657, 45.7517141},
properties: %{}, properties: %{},