Created
October 20, 2011 15:58
-
-
Save kellymclaughlin/1301507 to your computer and use it in GitHub Desktop.
test.erl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-ifdef(TEST). | |
test_test() -> | |
%% Start erlang node | |
application:start(sasl), | |
TestNode = list_to_atom("testnode" ++ integer_to_list(element(3, now())) ++ | |
"@localhost"), | |
net_kernel:start([TestNode, longnames]), | |
application:start(riakc), | |
application:start(inets), | |
application:start(mochiweb), | |
application:start(crypto), | |
application:start(webmachine), | |
application:start(lager), | |
application:load(riak_moss), | |
application:set_env(riak_moss, moss_ip, "127.0.0.1"), | |
application:set_env(riak_moss, moss_port, 8080), | |
application:start(riak_moss), | |
io:format("started ~p ~n", [application:which_applications()]), | |
BucketNames = ["foo", "bar", "baz"], | |
UserName = "fooser", | |
{ok, User} = riak_moss_riakc:create_user(UserName), | |
KeyID = User#moss_user.key_id, | |
[riak_moss_riakc:create_bucket(KeyID, Name) || Name <- BucketNames], | |
CorrectJsonBucketNames = mochijson2:encode(BucketNames), | |
ResultToTest = to_json(fake_rd, #context{user=User}), | |
?assertEqual(CorrectJsonBucketNames, ResultToTest). | |
-endif. | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
09:56:14.396 [info] Application lager started on node 'testnode233612@localhost' | |
Pot: 8080 | |
09:56:14.416 [info] Application riak_moss started on node 'testnode233612@localhost' | |
riak_moss_wm_service: test_test (module 'riak_moss_wm_service')...*failed* | |
::error:{assertEqual_failed, | |
[{module,riak_moss_wm_service}, | |
{line,118}, | |
{expression,"ResultToTest"}, | |
{expected, | |
[91, | |
[91,"102",44,"111",44,"111",93], | |
44, | |
[91,"98",44,"97",44,"114",93], | |
44, | |
[91,"98",44,"97",44|...], | |
93]}, | |
{value, | |
{<<"[]">>,fake_rd, | |
{context,undefined, | |
{moss_user,"fooser", | |
"D14395DB97B52906589FB5EF95DD39827C1969B3", | |
[...],...}}}}]} | |
in function riak_moss_wm_service:'-test_test/0-fun-0-'/2 | |
output:<<"started [{riak_moss,"riak_moss","0.0.1"}, | |
{lager,"Erlang logging framework","0.9.4"}, | |
{webmachine,"webmachine","1.9.0"}, | |
{mochiweb,"MochiMedia Web Server","1.5.1"}, | |
{inets,"INETS CXC 138 49","5.7.1"}, | |
{riakc,"Riak Client","1.2.0"}, | |
{sasl,"SASL CXC 138 11","2.1.10"}, | |
{crypto,"CRYPTO version 2","2.0.4"}, | |
{stdlib,"ERTS CXC 138 10","1.17.5"}, | |
{kernel,"ERTS CXC 138 10","2.14.5"}] | |
">> | |
======================================================= | |
Failed: 1. Skipped: 0. Passed: 0. | |
Cover analysis: /Users/kelly/Applications/basho/riak_moss/.eunit/index.html | |
Node State Type In Out Address | |
ERROR: One or more eunit tests failed. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment