from django.core.urlresolvers import reverse

from .base import TestBase


class TestLookups(TestBase):
    """Test suite for django-selectable lookups."""

    def test_login_regression(self):
        """Make sure lookups are login-protected"""
        url_name = 'selectable-lookup'
        rv = self.client.get(reverse(url_name, args=['workshops-sitelookup']))
        assert rv.status_code == 401  # unauthorized

        self._setUpUsersAndLogin()
        rv = self.client.get(reverse(url_name, args=['workshops-sitelookup']))
        assert rv.status_code == 200

Add regression test for login-required lookups
Add regression test for login-required lookups

New test makes sure that we never accidentally disable @login_required
on our lookups.
