danicuki
How to use ExVCR with Finch?
My project uses Finch to make parallel HTTP requests.
I tried to add VCR to my tests, but the HTTP requests are still happening.
Here is my test:
defmodule MyClientTest do
use ExUnit.Case, async: true
use ExVCR.Mock #, adapter: ExVCR.Adapter.Httpc
setup do
ExVCR.Config.cassette_library_dir("fixture/vcr_cassettes")
:ok
end
test "list_apps" do
use_cassette "list_apps" do
list_apps = MyClient.list_apps
assert MyClient.list_apps == ["app1", "app2"]
end
end
end
I see a list_apps.json file in the fixture/vcr_cassettes, but its content is only []
Here is my MyClient module:
defmodule MyClient do
alias Finch.Response
def child_spec do
{Finch,
name: __MODULE__,
pools: %{
"https://myapp.com" => [size: 100]
}}
end
def applications_response do
:get
|> Finch.build("https://myapp.com/v2/apps.json")
|> Finch.request(__MODULE__)
end
def handle_applications_response({:ok, %Response{body: body}}) do
body
|> Jason.decode!()
end
end
def list_apps do
handle_applications_response(applications_response())
end
end
How to apply VCR to my HTTP Finch calls?
Most Liked
NobbZ
I’m pretty sure you currently can’t, from the list of dependencies, I’d say it currently only supports interfacing with httpotion, httpoison and ibrowse.
1
Popular in Questions
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this:
...
New
Hi,
is there any work on GUI with Elixir, that is similar to Electron/Javascript? My idea is to bundle Phoenix and BEAM into a single se...
New
Hey,
I have a NanoPi-M3 and try to install Elixir on their Ubuntu image. I followed the Raspberry Pi installation instructions from the ...
New
Hey all, just started picking up Elixir last week and am writing a scraper as a learning project.
Baby step #1 is extracting the number ...
New
I tried installing
elixir 1.11.2
erlang 23.3.4
via asdf in my zsh shell. Enabled the versions locally and globally.
When I list them ...
New
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? https://hexdocs.pm/ecto/Ecto.Repo.h...
New
I will often find my self writing things similar to:
case some_value do
nil -> something()
"" -> something()
_ -> someth...
New
Original source of discussion: This topic on the Pragmatic Programmers' Functional Web Development with Elixir, OTP, and Phoenix forum.
...
New
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors:
[WARN] - (starship::utils): Executing command ...
New
I’ve been re-reading swift book again and noticed that multiline strings there don’t have a trailing line break, unlike in elixir
iex(2)...
New
Other popular topics
Manning 2016 Halloween weekend sale via Deal of the Day
Friday, October 28 - Half off all MEAPs - code WM102816LT
Saturday, October 29 ...
New
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
Good day to you all.
I have been struggling to get a query involving like and ilike to work.
Can anyone assist me on this, please?
pro...
New
Hi folks,
Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
New
i’m a new one to elixir
which editor can i use
vs code? or atom?
Thanks! :smiley:
New
Hey all,
I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
Hi everyone,
One of the features added to Elixir early on to help integration with Erlang code was the idea of overridable function defi...
New
I have a super simple question about elixir - how would I take a file like this
foo bar baz
and output a new file that enumerates th...
New
Hey :wave:t3: Elixir community,
I’ve been learning Elixir, and working on some side projects. My editor of choice is VSCode, and althoug...
New







