def METHOD_NAME(self):
    """Test for ajax endpoint with search parameter."""
    img = ImageFactory()
    url = urlparams(reverse("gallery.async"), type="image", q="foobar")
    response = self.client.get(url, follow=True)
    self.assertEqual(200, response.status_code)
    doc = pq(response.content)
    imgs = doc("#media-list li img")
    self.assertEqual(0, len(imgs))
    url = urlparams(reverse("gallery.async"), type="image", q=img.title)
    response = self.client.get(url, follow=True)
    self.assertEqual(200, response.status_code)
    doc = pq(response.content)
    imgs = doc("#media-list li img")
    self.assertEqual(1, len(imgs))
    self.assertEqual(img.thumbnail_url_if_set(), imgs[0].attrib["src"])