Page MenuHomePhorge

No OneTemporary

Size
2 KB
Referenced Files
None
Subscribers
None
diff --git a/config/config.exs b/config/config.exs
index b1c965d..cb22775 100644
--- a/config/config.exs
+++ b/config/config.exs
@@ -1,22 +1,23 @@
# This file is responsible for configuring your application
# and its dependencies with the aid of the Mix.Config module.
use Mix.Config
config :tesla, adapter: Tesla.Adapter.Httpc
config :logger, :console,
level: :debug,
format: "$date $time [$level] $metadata$message\n"
if Mix.env == :test do
config :httparrot,
- http_port: 8888,
- ssl: false,
+ http_port: 5080,
+ https_port: 5443,
+ ssl: true,
unix_socket: false
config :sasl,
errlog_type: :error,
sasl_error_logger: false
config :tesla, MockClient, adapter: Tesla.Mock
end
diff --git a/test/support/adapter_case.ex b/test/support/adapter_case.ex
index 307ffa8..3e54940 100644
--- a/test/support/adapter_case.ex
+++ b/test/support/adapter_case.ex
@@ -1,12 +1,13 @@
defmodule Tesla.AdapterCase do
defmacro __using__(adapter: adapter) do
quote do
@adapter unquote(adapter)
@http "http://localhost:#{Application.get_env(:httparrot, :http_port)}"
+ @https "https://localhost:#{Application.get_env(:httparrot, :https_port)}"
defp call(env, opts \\ []) do
@adapter.call(env, opts)
end
end
end
end
diff --git a/test/support/adapter_case/ssl.ex b/test/support/adapter_case/ssl.ex
index a44525a..49168b5 100644
--- a/test/support/adapter_case/ssl.ex
+++ b/test/support/adapter_case/ssl.ex
@@ -1,19 +1,19 @@
defmodule Tesla.AdapterCase.SSL do
- defmacro __using__(_) do
+ defmacro __using__(opts) do
quote do
alias Tesla.Env
describe "SSL" do
test "GET request" do
request = %Env{
method: :get,
- url: "https://github.com/teamon/tesla"
+ url: "#{@https}/ip"
}
- assert %Env{} = response = call(request)
+ assert %Env{} = response = call(request, unquote(opts))
assert response.status == 200
end
end
end
end
end
diff --git a/test/tesla/adapter/hackney_test.exs b/test/tesla/adapter/hackney_test.exs
index ba12a0e..02384fd 100644
--- a/test/tesla/adapter/hackney_test.exs
+++ b/test/tesla/adapter/hackney_test.exs
@@ -1,21 +1,23 @@
defmodule Tesla.Adapter.HackneyTest do
use ExUnit.Case
use Tesla.AdapterCase, adapter: Tesla.Adapter.Hackney
use Tesla.AdapterCase.Basic
use Tesla.AdapterCase.Multipart
use Tesla.AdapterCase.StreamRequestBody
- use Tesla.AdapterCase.SSL
+ use Tesla.AdapterCase.SSL, ssl_options: [
+ cacertfile: "#{:code.priv_dir(:httparrot)}/ssl/server-ca.crt"
+ ]
alias Tesla.Env
test "get with `with_body: true` option" do
request = %Env{
method: :get,
url: "#{@http}/ip"
}
assert %Env{} = response = call(request, with_body: true)
assert response.status == 200
end
end

File Metadata

Mime Type
text/x-diff
Expires
Mon, Nov 25, 5:09 PM (1 d, 10 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
39963
Default Alt Text
(2 KB)

Event Timeline