'KB rebuild scheduled on delete'

@mock.patch.object(views, 'schedule_rebuild_kb')
def test_schedule_rebuild_kb_on_delete(self, schedule_rebuild_kb):

    im = ImageFactory()
    u = UserFactory()
    add_permission(u, Image, 'delete_image')
    self.client.login(username=u.username, password='testpass')
    r = post(self.client, 'gallery.delete_media', args=['image', im.id])
    eq_(200, r.status_code)
    eq_(0, Image.objects.count())
    assert schedule_rebuild_kb.called
