<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Apr 11, 2013 at 8:37 PM, Brown, Kevin <span dir="ltr"><<a href="mailto:Kevin.Brown@turner.com" target="_blank">Kevin.Brown@turner.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
Cowfolk,<br>
<br>
I am doing something like this to create an #http_req suitable for unit<br>
testing my resource callbacks:<br></blockquote><br><br></div><div class="gmail_quote">I use the library meck(<a href="https://github.com/eproxus/meck">https://github.com/eproxus/meck</a>) to test stuff doing something like this:<br>
<br>some_test() -><br>  meck:expect(cowboy_req, binding, 2, {<<"app_key">>, req} )<br>  ?assertEqual({ok, req, empty},<br>                 websocket_handler:websocket_init(transport, req, opts)),<br>
  ?assert(meck:validate(cowboy_req)).<br><br></div><div class="gmail_quote">I use simple atoms as input and mock the cowboy_req functions to return atoms that would represent the correct or the wrong answer. <br><br></div>
<div class="gmail_quote">The real implementation or how cowboy represent stuff is not important here, just the output pattern like {Binding, Req}.<br><br></div><div class="gmail_quote">That's it<br clear="all"></div><br>
-- <br><br>Eduardo<br></div></div>