Commits

Andy Gross  committed c5d03df

test for jiak_util:bucket_from_uri

  • Participants
  • Parent commits 968b4ed

Comments (0)

Files changed (1)

File src/jiak_util.erl

          default_jiak_module/1,
          bucket_from_uri/1]).
 
+-include_lib("eunit/include/eunit.hrl").
+
 %% @private
 jiak_required_props() -> [allowed_fields,required_fields,read_mask,write_mask].
 
 bucket_from_uri(RD) ->
     try {ok, list_to_existing_atom(wrq:path_info(bucket, RD))}
     catch _:_ -> {error, no_such_bucket} end.
+
+bucket_from_uri_test() ->
+    foo, %% make sure the atom exists
+    PI = dict:store(bucket, "foo", dict:new()),
+    RD0 = wrq:create('PUT', "1.1", "/jiak/foo", mochiweb_headers:empty()),
+    RD = wrq:load_dispatch_data(PI, none, none, none, none, RD0),
+    {ok, foo} = bucket_from_uri(RD).
+