From 28ea984c2e5d781e4b60ad66707451ef595b263a Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Sun, 4 May 2014 22:56:02 +0200 Subject: Add (very few) tests and build them. --- Emakefile | 8 +++++--- test/ctls_test.erl | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 test/ctls_test.erl diff --git a/Emakefile b/Emakefile index 8869cf4..a42a6ee 100644 --- a/Emakefile +++ b/Emakefile @@ -1,3 +1,5 @@ -%% erl -make (-*- erlang -*-) -{"src/*", [debug_info, {i, "include/"}, {outdir, "ebin/"}]}. -{"test/*", [debug_info, {i, "include/"}, {outdir, "ebin/"}]}. +%% erl -make (-*- erlang -*-) +{["src/*", "test/*"], + [debug_info, + {i, "include/"}, + {outdir, "ebin/"}]}. 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}. -- cgit v1.1