title: Testing for 400 errors with paste on a web.py app
body: <p>I'm using paste to do some functional testing on my 'controllers' in my web.py app. In one case I'm trying to test for a 400 response when a malformed post is made to an API endpoint. Here is what my test looks like:</p>
  
  <pre><code>def test_api_users_index_post_malformed(self):
      r = self.testApp.post('/api/users', params={})
      assert r.header('Content-Type') == 'application/json'
      assert r.status == 400
  </code></pre>
  
  <p>But I'm getting the following exception:</p>
  
  <pre><code>AppError: Bad response: 400 Bad Request (not 200 OK or 3xx redirect for /api/users)
  </code></pre>
  
  <p>I see paste has HttpException middleware, but I can't find any examples on how to use it or if its even the right way to go. Any suggestions? Or am I just going about this wrong?</p>