anchor.diff:  -include_lib("eunit/include/eunit.hrl").
   
   logplex_api_test_() ->
  +    Port =
  +        case os:getenv("HTTP_PORT") of
  +            false -> "80";
  +            Val -> Val
  +        end,
       AppId = 1,
       AppName = "app1@logplex.heroku.com",
       MsgBodies = [
  
positive.code:          {"Create Heroku token",
              fun() ->
                  Ret = http:request(post, 
                      {"http://localhost:8002/channels/" ++ get(channel_id) ++ "/token", headers(), content_type(), iolist_to_binary(mochijson2:encode({struct, [
                          {"channel_id", list_to_binary(get(channel_id))},
                          {"name", <<"heroku">>}
                      ]}))}, [], []),
  
negative.code:          {"Downgrade to basic addon",
              ?_assertMatch({ok,{{_,200,_},_,"OK"}},
                  http:request(post, 
                      {"http://localhost:" ++ Port ++ "/channels/" ++ get(channel_id) ++ "/addon", headers(), content_type(), iolist_to_binary(mochijson2:encode({struct, [
                          {"addon", <<"basic">>}
                      ]}))}, [], []))},
           {"Create session",
             fun() ->
                 Ret = http:request(post, 
                     {"http://localhost:" ++ Port ++ "/sessions", headers(), content_type(), iolist_to_binary(mochijson2:encode({struct, [
                         {"channel_id", list_to_binary(get(channel_id))},
                         {"name", list_to_binary(AppName)}
                     ]}))}, [], []),
  