Comments (3)
Thanks for the report and sorry being late to check.
I'm running the test in your repository (https://github.com/weppos/dnsimple-elixir on branch test-create
) and I can see the following 2 errors.
1) test .create_domains returns a Dnsimple.Response (DnsimpleDomainsServiceTest)
test/dnsimple_domains_service_test.exs:39
** (ExVCR.InvalidRequestError) response for [URL:https://api.dnsimple.test/v2/1010/domains, METHOD:post] was not found
stacktrace:
lib/exvcr/handler.ex:28: ExVCR.Handler.get_response_from_cache/2
lib/exvcr/handler.ex:13: ExVCR.Handler.get_response/2
(hackney) :hackney.request(:post, "https://api.dnsimple.test/v2/1010/domains", [{"Accept", "application/json"}, {"User-Agent", "dnsimple-elixir/0.0.1"}, {"Authorization", "Bearer i-am-a-token"}], "", [])
(httpoison) lib/httpoison/base.ex:396: HTTPoison.Base.request/9
(httpoison) lib/httpoison.ex:66: HTTPoison.request!/5
(dnsimple) lib/dnsimple.ex:123: Dnsimple.Client.execute/6
(dnsimple) lib/dnsimple/domains_service.ex:32: Dnsimple.DomainsService.create_domain/5
test/dnsimple_domains_service_test.exs:42
.....
2) test .create_domain builds the correct request (DnsimpleDomainsServiceTest)
test/dnsimple_domains_service_test.exs:32
** (ExVCR.InvalidRequestError) response for [URL:https://api.dnsimple.test/v2/1010/domains, METHOD:post] was not found
stacktrace:
lib/exvcr/handler.ex:28: ExVCR.Handler.get_response_from_cache/2
lib/exvcr/handler.ex:13: ExVCR.Handler.get_response/2
(hackney) :hackney.request(:post, "https://api.dnsimple.test/v2/1010/domains", [{"Content-Type", "application/json"}, {"Accept", "application/json"}, {"User-Agent", "dnsimple-elixir/0.0.1"}, {"Authorization", "Bearer i-am-a-token"}], "{\"name\":\"example.com\"}", [])
(httpoison) lib/httpoison/base.ex:396: HTTPoison.Base.request/9
(httpoison) lib/httpoison.ex:66: HTTPoison.request!/5
(dnsimple) lib/dnsimple.ex:123: Dnsimple.Client.execute/6
(dnsimple) lib/dnsimple/domains_service.ex:32:
It seems the @service.create_domain
is running post
request, and it's mismatched with the request parameters. Updating as follows make sense for you?
--- a/test/dnsimple_domains_service_test.exs
+++ b/test/dnsimple_domains_service_test.exs
@@ -30,14 +30,14 @@ defmodule DnsimpleDomainsServiceTest do
test ".create_domain builds the correct request" do
- fixture = ExvcrUtils.response_fixture("createDomain/created.http", [method: "delete", url: @client.base_url <> "/v2/1010/domains", request_body: ~s'{"name":"example.com"}'])
+ fixture = ExvcrUtils.response_fixture("createDomain/created.http", [method: "post", url: @client.base_url <> "/v2/1010/domains", request_body: ~s'{"name":"example.com"}'])
use_cassette :stub, fixture do
@service.create_domain(@client, "1010", %{ name: "example.com" })
end
end
test ".create_domains returns a Dnsimple.Response" do
- fixture = ExvcrUtils.response_fixture("createDomain/created.http", [url: "~r/\/v2/$", request_body: ""])
+ fixture = ExvcrUtils.response_fixture("createDomain/created.http", [method: "post", url: "~r/\/v2/$", request_body: ""])
use_cassette :stub, fixture do
{ :ok, response } = @service.create_domain(@client, "1010", "")
assert response.__struct__ == Dnsimple.Response
The following part sounds valid, and I'm thinking to update as you suggested.
I suggest to remove options[:stub] != nil and just run the match when an explicit request_body parameter is set.
from exvcr.
Oh, wow, that's embarrassing. I can't believe I was using a delete
instead of a post
.
The following part sounds valid, and I'm thinking to update as you suggested.
That would be awesome! Thanks for your follow up.
from exvcr.
Thanks for the quick checking. Regarding the fix part, please allow some time to merge to master looking for good timing.
from exvcr.
Related Issues (20)
- ignore tzdata HOT 2
- Problem with ExJsx dependency HOT 10
- Request was made? HOT 1
- ExVCR.IEx not working with adapter: ExVCR.Adapter.Hackney HOT 2
- disable global mock HOT 14
- Global Mock does not use cassettes with HTTPoison HOT 2
- How to use ExVCR with Finch? HOT 3
- Filter sensitive data after all request made HOT 1
- Support `mix vcr.check --include mytag` ?
- Can't match json response bodies for removing sensitive data? HOT 1
- Cassettes are not injected after test cases! HOT 1
- ** (ArgumentError) argument error
- Support for Finch 0.9.x? HOT 1
- Feature request: `start_cassette` and `stop_cassette`
- Same as vcr request: save response json body with more formatting HOT 1
- Generated custom_cassettes with patchfile HOT 1
- Wrong responses when HTTPoison is used from async Task HOT 4
- Async tests using Bypass interfere with ExVcr tests HOT 3
- support httpoison 2.0 HOT 1
- Version `0.14.0` cannot be compiled in projects not using `Finch`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from exvcr.