summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordberg.se>2014-05-04 22:56:02 +0200
committerLinus Nordberg <linus@nordberg.se>2014-05-04 22:56:02 +0200
commit28ea984c2e5d781e4b60ad66707451ef595b263a (patch)
tree83b729fed373bb90891b005bf5c98cd177a0e64b /test
parented8bb6d1e454b9ddc793f74f682bd80b1c728904 (diff)
Add (very few) tests and build them.
Diffstat (limited to 'test')
-rw-r--r--test/ctls_test.erl20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/ctls_test.erl b/test/ctls_test.erl
new file mode 100644
index 0000000..1d8438c
--- /dev/null
+++ b/test/ctls_test.erl
@@ -0,0 +1,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}.