<br><br><div class="gmail_quote">On Fri, Nov 5, 2010 at 9:09 AM, C. Titus Brown <span dir="ltr">&lt;<a href="mailto:ctb@msu.edu">ctb@msu.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On Fri, Nov 05, 2010 at 08:38:25AM -0400, Alfredo Deza wrote:<br>
&gt; On Fri, Nov 5, 2010 at 4:52 AM, Alex &lt;<a href="mailto:alex.lavoro.propio@gmail.com">alex.lavoro.propio@gmail.com</a>&gt; wrote:<br>
</div><div class="im">&gt; &gt; The best solution would be a high-level (HTTP-level) Python<br>
&gt; &gt; module/wrapper for &#39;pycap&#39;, which operates in &#39;packet&#39; level. This<br>
&gt; &gt; said module use pycap to capture and filter HTTP requests and returns<br>
&gt; &gt; the result in a more Pythonic data structures. This module should<br>
&gt; &gt; start a thread which captures HTTP requests while the test case is<br>
&gt; &gt; being executed.<br>
&gt; &gt;<br>
&gt; &gt; I cannot find anything which does what I&#39;ve just describe. Please<br>
&gt; &gt; correct if I am wrong.<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; I think no one has mentioned it in this thread, but to test our application<br>
&gt; we use<br>
&gt; TestApp [1] from WebTest [2] (by Ian Bicking) which covers most of what you<br>
&gt; mention.<br>
&gt;<br>
&gt; All requests are captured, and you can evaluate any parts of the response.<br>
&gt;<br>
&gt; We hook WebTest into the setUp method and we get full isolation from<br>
&gt; other tests that are running, we even got py.test to run in parallel with<br>
&gt; this same method achieving total isolation from other tests.<br>
<br>
</div>Hi Alfredo,<br>
<br>
Alex has specified his problem in such a way that WebTest can&#39;t solve it,<br>
unless I&#39;m missing something... WebTest is another Python-specific solution,<br>
based around WSGI, right?<br>
<br></blockquote><div>Yes WebTest is based around WSGi but as I understood it, Alex mentioned:</div><div><br></div><div>&quot;<span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">The target to be tested is a C++ application, so  Python tools like</span></div>
<meta charset="utf-8"><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">wsgi_intercept, twill, mechanize do not apply.&quot;</span></div><div class="gmail_quote">
<font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><br></span></font></div><div class="gmail_quote"><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">Which doesn&#39;t apply (correct me if I am wrong)  to a WSGI application wrapped </span></font></div>
<div class="gmail_quote"><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">around WebTest. </span></font></div><div class="gmail_quote"><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><br>
</span></font></div><div class="gmail_quote"><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">I just don&#39;t </span></font><span class="Apple-style-span" style="font-family: arial, sans-serif; border-collapse: collapse; ">see how a C++ app would not be able to call it so he can record </span></div>
<div class="gmail_quote"><span class="Apple-style-span" style="font-family: arial, sans-serif; border-collapse: collapse; "><br></span></div><div class="gmail_quote"><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">For example, when we test external API&#39;s that do not have a sandbox and we </span></font></div>
<div class="gmail_quote"><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">need to make HTTP calls that return certain responses, we create something </span></font></div>
<div class="gmail_quote"><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">similar to a WSGI app (in some cases we use Bottle) </span></font><span class="Apple-style-span" style="font-family: arial, sans-serif; border-collapse: collapse; ">that has WebTest around </span></div>
<div class="gmail_quote"><span class="Apple-style-span" style="font-family: arial, sans-serif; border-collapse: collapse; ">it, calls and responses are captured no matter </span><span class="Apple-style-span" style="font-family: arial, sans-serif; border-collapse: collapse; ">where you are starting the call from.</span></div>
<div class="gmail_quote"><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><br></span></font></div><div class="gmail_quote"><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">But then again, I might be wrong applying those solutions to Alex&#39;s problem :)</span></font></div>
<div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
best,<br>
--titus<br>
<font color="#888888">--<br>
</font><div><div></div><div class="h5">C. Titus Brown, <a href="mailto:ctb@msu.edu">ctb@msu.edu</a><br>
</div></div></blockquote></div><br>