def test_internal_error(self): c = Client() with patch('search.court_search.CourtSearch.get_courts', Mock(side_effect=CourtSearchError('something went wrong'))): response = c.get('/search/results.json?q=Accrington') self.assertEquals(500, response.status_code) self.assertIn("something went wrong", response.content)
def test_court_postcode_search_error(self): with patch('search.court_search.CourtSearch.get_courts', Mock(side_effect=CourtSearchError('something went wrong'))): c = Client() with self.assertRaises(CourtSearchError): response = c.get('/search/results?postcode=SE15+4PE')
def test_court_address_search_error(self): with patch('search.court_search.CourtSearch.get_courts', Mock(side_effect=CourtSearchError('something went wrong'))): c = Client() with self.assertRaises(CourtSearchError): response = c.get('/search/results?q=Accrington')