Add anonymous and remote participations
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
defmodule Mobilizon.Service.Geospatial.MapQuestTest do
|
||||
use ExVCR.Mock, adapter: ExVCR.Adapter.Hackney
|
||||
|
||||
use Mobilizon.DataCase, async: false
|
||||
use Mobilizon.DataCase
|
||||
|
||||
import Mock
|
||||
|
||||
@@ -9,12 +9,15 @@ defmodule Mobilizon.Service.Geospatial.MapQuestTest do
|
||||
alias Mobilizon.Config
|
||||
alias Mobilizon.Service.Geospatial.MapQuest
|
||||
|
||||
@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 "without API Key triggers an error" do
|
||||
@@ -23,7 +26,7 @@ defmodule Mobilizon.Service.Geospatial.MapQuestTest do
|
||||
end
|
||||
end
|
||||
|
||||
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,
|
||||
@@ -41,7 +44,7 @@ defmodule Mobilizon.Service.Geospatial.MapQuestTest do
|
||||
assert_called(
|
||||
HTTPoison.get(
|
||||
"https://open.mapquestapi.com/geocoding/v1/address?key=toto&location=10%20Rue%20Jangot&maxResults=5",
|
||||
@httpoison_headers
|
||||
httpoison_headers
|
||||
)
|
||||
)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user