Add anonymous and remote participations

This commit is contained in:
Thomas Citharel
2019-12-20 13:04:34 +01:00
parent 17e0b3968f
commit 2ed9050a90
135 changed files with 10141 additions and 2271 deletions

View File

@@ -1,7 +1,7 @@
defmodule Mobilizon.Service.Geospatial.PhotonTest do
use ExVCR.Mock, adapter: ExVCR.Adapter.Hackney
use Mobilizon.DataCase, async: false
use Mobilizon.DataCase
import Mock
@@ -9,15 +9,18 @@ defmodule Mobilizon.Service.Geospatial.PhotonTest do
alias Mobilizon.Config
alias Mobilizon.Service.Geospatial.Photon
@httpoison_headers [
{"User-Agent",
"#{Config.instance_name()} #{Config.instance_hostname()} - Mobilizon #{
Mix.Project.config()[:version]
}"}
]
setup do
# Config.instance_user_agent/0 makes database calls so because of ownership connection
# we need to define it like this instead of a constant
# See https://hexdocs.pm/ecto_sql/Ecto.Adapters.SQL.Sandbox.html
{:ok,
httpoison_headers: [
{"User-Agent", Config.instance_user_agent()}
]}
end
describe "search address" do
test "produces a valid search address with options" do
test "produces a valid search address with options", %{httpoison_headers: httpoison_headers} do
with_mock HTTPoison,
get: fn _url, _headers ->
{:ok, %HTTPoison.Response{status_code: 200, body: "{\"features\": []"}}
@@ -30,7 +33,7 @@ defmodule Mobilizon.Service.Geospatial.PhotonTest do
assert_called(
HTTPoison.get(
"https://photon.komoot.de/api/?q=10%20Rue%20Jangot&lang=fr&limit=5",
@httpoison_headers
httpoison_headers
)
)
end