Source

luwak / test / luwak_file_tests.erl

The default branch has multiple heads

-module(luwak_file_tests).

-include_lib("eunit/include/eunit.hrl").

object_creation_test() ->
  test_helper:riak_test(fun(Riak) ->  
      Dict = dict:new(),
      luwak_file:create(Riak, <<"file1">>, dict:store(key, value, Dict)),
      {ok, Obj} = luwak_file:get(Riak, <<"file1">>),
      Attr = luwak_file:get_attributes(Obj),
      ?assertEqual({ok, value}, dict:find(key, Attr))
    end).
    
set_attributes_test() ->
  test_helper:riak_test(fun(Riak) ->
      Dict = dict:new(),
      {ok, Obj} = luwak_file:create(Riak, <<"file1">>, dict:store(key, value, Dict)),
      {ok, Obj2} = luwak_file:set_attributes(Riak, Obj, dict:store(key, blah, Dict)),
      Attr = luwak_file:get_attributes(Obj2),
      ?assertEqual({ok, blah}, dict:find(key, Attr))
    end).
    
exists_test() ->
  test_helper:riak_test(fun(Riak) ->
      {ok, _Obj} = luwak_file:create(Riak, <<"file1">>, dict:new()),
      ?assertEqual({ok, true}, luwak_file:exists(Riak, <<"file1">>))
    end).
  
delete_test() ->
  test_helper:riak_test(fun(Riak) ->
      {ok, _Obj} = luwak_file:create(Riak, <<"file1">>, dict:new()),
      ok = luwak_file:delete(Riak, <<"file1">>),
      ?assertEqual({ok, false}, luwak_file:exists(Riak, <<"file1">>))
    end).
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.