Skip to content

Instantly share code, notes, and snippets.

@bradfordw
Created April 22, 2009 20:12
Show Gist options
  • Select an option

  • Save bradfordw/100041 to your computer and use it in GitHub Desktop.

Select an option

Save bradfordw/100041 to your computer and use it in GitHub Desktop.
-module(etap_t_001).
-export([start/0]).
start() ->
etap:plan(8),
etap_application:start_ok(inets, "Application inets starts"),
etap_web:simple_200("http://0.0.0.0:8000/", "GET / returns 200."),
RequestPostDB = etap_web:build_request(post, "http://0.0.0.0:8000/_db", [], [<<"test_cache">>]),
RequestPostDB:status_is(201, "POST for successful create returns 201."),
RequestDeleteDB = etap_web:build_request(delete, "http://0.0.0.0:8000/_db",[],[<<"test_cache">>]),
RequestDeleteDB:status_is(200, "Deleting namespace returns 200."),
etap_web:simple_404("http://0.0.0.0:8000/test_cache", "Web request against missing namespace returns a 404."),
RequestPostDBForExpTest = etap_web:build_request(post, "http://0.0.0.0:8000/_db", [], ["test_exp"]),
RequestPostDBForExpTest:status_is(201),
PostKeyImmediateExpiration = etap_web:build_request(post, "http://0.0.0.0:8000/test_exp/foo", [{"X-Lantern-Expires","0"}],["bar"]),
PostKeyImmediateExpiration:status_is(201),
GetExpiredKey = etap_web:build_request(get,"http://0.0.0.0:8000/test_exp/foo",[],[]),
GetExpiredKey = etap_web:status_is(410,"Web request against expired key returns a 410."),
etap_web:simple_404("http://0.0.0.0:8000/nodb/nokey", "Web request against missing db/key returns a 404."),
etap:end_tests().
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment