summaryrefslogtreecommitdiff
path: root/test/ctls_test.erl
blob: d859b6e29a722737ab136787b3e46ea34dd93c1b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
-module(ctls_test).
-include_lib("eunit/include/eunit.hrl").

%% Requires that ctls is running (or, at the moment, that v1 has been
%% installed as an mod_esi module -- use https_server:start()).

add_chain_test_() ->
    {setup,
     fun() ->
             Url = "https://flimsytest:8080/ct/v1/add_chain",
             Input = "{\"chain\": [\"some test data\"]}",
             {OK, {{_, RC, _}, _, _}} = httpc:request(post, {Url, [], [], Input}, [], []),
             %% TODO: Verify signature.
             {OK, RC}
     end,
     fun(_) -> ok end,
     fun({OK, RC}) ->
             [?_assertEqual(ok, OK),
              ?_assertEqual(RC, 200)]
     end}.