PageRenderTime 24ms CodeModel.GetById 14ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/priv/sites/testsandbox/tests/testsandbox_basic_tests.erl

https://code.google.com/p/zotonic/
Erlang | 26 lines | 18 code | 5 blank | 3 comment | 0 complexity | 220d0c561c5e596ea1dd0051a5a94e03 MD5 | raw file
 1-module(testsandbox_basic_tests).
 2
 3-include_lib("eunit/include/eunit.hrl").
 4
 5%% Test if the site-specific testsandbox module is installed and running.
 6testsandbox_enabled_test() ->
 7    C = z_context:new(testsandbox),
 8    ?assertEqual(z_module_manager:active(testsandbox, C), true),
 9    ok.
10
11%% Test if some default modules are running.
12default_modules_test() ->
13    C = z_context:new(testsandbox),
14    ?assertEqual(z_module_manager:active(mod_base, C), true),
15    ?assertEqual(z_module_manager:active(mod_admin, C), true),
16    ok.
17
18%% Test if the webserver is running, by looking at the home tpl.
19testsandbox_site_up_test() ->
20    C = z_context:new(testsandbox),
21    X = http:request(get, {"http://" ++ z_context:hostname_port(C) ++ "/", []}, [], []),
22    ?assertMatch({ok,{{"HTTP/1.1",200,"OK"}, _, _}}, X),
23    {ok,{_, _, Body}} = X,
24    ?assertMatch({match, _}, re:run(Body, "<title>Zotonic test sandbox</title>")),
25    ok.
26