title: Python mox urllib2's Request and urllopen function
body: <p>I was trying to mox</p>
  
  <pre><code>req = urllib2.Request(
      rest_url, json.dumps(data), {'Content-Type': 'application/json'})
  req = urllib2.urlopen(req)
  chunk_size = 1024 * 1024
  while True:
     chunk = req.read(chunk_size)
     if not chunk:
       break
     fd.write(chunk)
  </code></pre>
  
  <p>Can anyone help me with writing the mox tests for this? I was trying following piece </p>
  
  <pre><code>self.mox.StubOutWithMock(urllib2, "Request")
  self.mox.StubOutWithMock(urllib2, "urlopen")
  res = self.mox.CreateMockAnything(urllib2.Request)
  urllib2.Request(IgnoreArg(), IgnoreArg(), IgnoreArg()).AndReturn(req).AndReturn(res)
  </code></pre>
  
  <p>But throws error</p>
  
  <pre><code>urllib2.Request(IgnoreArg(), IgnoreArg(), IgnoreArg()).AndReturn(req).AndReturn(res)
  raise TypeError('Not callable')
  TypeError: Not callable
  </code></pre>