anchor.diff:  %% Test cases for the examples provided by Amazon here:
   %% http://docs.amazonwebservices.com/AmazonS3/latest/dev/index.html?RESTAuthentication.html
   
  -example_get_object_test() ->
  +auth_test_() ->
  +    {spawn,
  +     [
  +      {setup,
  +       fun setup/0,
  +       fun teardown/1,
  +       fun(_X) ->
  +               [
  +                example_get_object(),
  +                example_put_object(),
  +                example_list(),
  +                example_fetch(),
  +                example_delete(),
  +                example_upload(),
  +                example_list_all_buckets(),
  +                example_unicode_keys()
  +               ]
  +       end
  +      }]}.
  +
  +setup() ->
  +    application:set_env(riak_moss, moss_root_host, "s3.amazonaws.com").
  +
  +teardown(_) ->
  +    application:unset_env(riak_moss, moss_root_host).
  +
  +test_fun(Description, ExpectedSignature, CalculatedSignature) ->
  +    {Description,
  +     fun() ->
  +             [
  +              ?_assert(check_auth(ExpectedSignature, CalculatedSignature))
  +             ]
  +     end
  +    }.
  +
  +example_get_object() ->
       KeyData = "uV3F3YluFJax1cknvbcGwgjvx4QpvB+leU8dUj2o",
       Method = 'GET',
       Version = {1, 1},
  
positive.code: -include_lib("eunit/include/eunit.hrl").
  -endif.
  
  
  -spec authenticate(term(), [string()]) -> {ok, #moss_user{}}
                                                | {ok, unknown}
                                                | {error, atom()}.
  -compile(export_all).
  -export([authenticate/2]).
  
  %% ===================================================================
  %% Public API
  %% ===================================================================
  
  authenticate(RD, [KeyID, Signature]) ->
      %% @TODO Also handle riak connection error
      case riak_moss_utils:get_user(KeyID) of
  
negative.code:     RD = wrq:create(Method, Version, Path, Headers),
      ExpectedSignature = "k3nL7gH3+PadhTEVn5Ip83xlYzk=",
      CalculatedSignature = calculate_signature(KeyData, RD),
      test_fun("example delete test", ExpectedSignature, CalculatedSignature).
  
  %% @TODO This test case should be specified using two separate
  %% X-Amz-Meta-ReviewedBy headers, but Amazon strictly interprets
  