title: Monkeypatching views with Django's LiveServerTestCase
body: <p>I'm attempting to write tests for the frontend behavior of my application, using Selenium. However, the pages I'm attempting to test get their data from Solr, and I don't want to spin up a Solr instance in order to run the tests.</p>
  
  <p>I'm using py.test and <a href="http://pytest-django.readthedocs.org/en/latest/" rel="nofollow">py.test-django</a> my tests, and I'm attempting to monkeypatch the views in order to make assertions about the data sent by the Selenium browser.</p>
  
  <p>For example, this is a test that I would expect to fail:</p>
  
  <pre class="lang-py prettyprint-override"><code>def test_search(self, live_server, browser, monkeypatch):
      def mockview(request):
          from django.http import HttpResponse
          assert True == False
          return HttpResponse('Test')
  
      monkeypatch.setattr(project.app.views, 'search', mockview)
  
      browser.get(live_server.url + reverse('app:search'))
  </code></pre>
  
  <p>I would expect this to fail when the browser attempts to load the 'app:search' page. Instead, it loads the normal version of the page and the test succeeds.</p>
  
  <p>Is there a way to get this behavior? Or is there a better way to approach these tests?</p>