aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2013-01-22 14:22:28 +0100
committerLoïc Hoguin <[email protected]>2013-01-22 14:22:28 +0100
commit3b8a1365d15ef6690160292902cf3fd1fd523fc9 (patch)
treee096d121fa98df1ea1355d6384bd1a7a4dc7599e /test
parent647e95aed157edd58c86acdd774048593eb9d039 (diff)
downloadcowboy-3b8a1365d15ef6690160292902cf3fd1fd523fc9.tar.gz
cowboy-3b8a1365d15ef6690160292902cf3fd1fd523fc9.tar.bz2
cowboy-3b8a1365d15ef6690160292902cf3fd1fd523fc9.zip
Do not require inets for running tests anymore
Diffstat (limited to 'test')
-rw-r--r--test/chunked_handler.erl2
-rw-r--r--test/http_SUITE.erl14
-rw-r--r--test/ws_SUITE.erl2
3 files changed, 11 insertions, 7 deletions
diff --git a/test/chunked_handler.erl b/test/chunked_handler.erl
index 4a43c1a..e486afe 100644
--- a/test/chunked_handler.erl
+++ b/test/chunked_handler.erl
@@ -9,7 +9,9 @@ init({_Transport, http}, Req, _Opts) ->
handle(Req, State) ->
{ok, Req2} = cowboy_req:chunked_reply(200, Req),
+ timer:sleep(100),
cowboy_req:chunk("chunked_handler\r\n", Req2),
+ timer:sleep(100),
cowboy_req:chunk("works fine!", Req2),
{ok, Req2, State}.
diff --git a/test/http_SUITE.erl b/test/http_SUITE.erl
index 4791f36..61316db 100644
--- a/test/http_SUITE.erl
+++ b/test/http_SUITE.erl
@@ -155,7 +155,6 @@ groups() ->
].
init_per_suite(Config) ->
- application:start(inets),
application:start(crypto),
application:start(ranch),
application:start(cowboy),
@@ -165,7 +164,6 @@ end_per_suite(_Config) ->
application:stop(cowboy),
application:stop(ranch),
application:stop(crypto),
- application:stop(inets),
ok.
init_per_group(http, Config) ->
@@ -477,10 +475,16 @@ check_status(Config) ->
{Ret, URL}
end || {Status, URL} <- Tests].
-%% @todo Convert to cowboy_client.
chunked_response(Config) ->
- {ok, {{"HTTP/1.1", 200, "OK"}, _, "chunked_handler\r\nworks fine!"}}
- = httpc:request(binary_to_list(build_url("/chunked_response", Config))).
+ Client = ?config(client, Config),
+ {ok, Client2} = cowboy_client:request(<<"GET">>,
+ build_url("/chunked_response", Config), Client),
+ {ok, 200, Headers, Client3} = cowboy_client:response(Client2),
+ true = lists:keymember(<<"transfer-encoding">>, 1, Headers),
+ {ok, Transport, Socket} = cowboy_client:transport(Client3),
+ {ok, <<"11\r\nchunked_handler\r\n\r\nB\r\nworks fine!\r\n0\r\n\r\n">>}
+ = Transport:recv(Socket, 44, 1000),
+ {error, closed} = cowboy_client:response(Client3).
%% Check if sending requests whose size is around the MTU breaks something.
echo_body(Config) ->
diff --git a/test/ws_SUITE.erl b/test/ws_SUITE.erl
index 92fd98b..61bb236 100644
--- a/test/ws_SUITE.erl
+++ b/test/ws_SUITE.erl
@@ -63,7 +63,6 @@ groups() ->
[{ws, [], BaseTests}].
init_per_suite(Config) ->
- application:start(inets),
application:start(crypto),
application:start(ranch),
application:start(cowboy),
@@ -73,7 +72,6 @@ end_per_suite(_Config) ->
application:stop(cowboy),
application:stop(ranch),
application:stop(crypto),
- application:stop(inets),
ok.
init_per_group(ws, Config) ->