blob: 492376a6021e4fd6f554eb787c3487c0e4bcb45d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
defmodule Recaptcha.Http.MockClient do
@moduledoc """
A mock HTTP client used for testing.
"""
alias Recaptcha.Http
def request_verification(body, options \\ [])
def request_verification("response=valid_response&secret=6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe" = body, options) do
send self(), {:request_verification, body, options}
{:ok, %{"success" => true, "challenge_ts" => "timestamp", "hostname" => "localhost"}}
end
# every other match is a pass through to the real client
def request_verification(body, options) do
send self(), {:request_verification, body, options}
Http.request_verification(body, options)
end
end
|