class TestDefaultBaseAuthorizationBackend(TestCase):
    """
    The behavior of a default, unspecialized `BaseAuthorizationBackend`.
    """

    def setUp(self):
        self.backend = BaseAuthorizationBackend()
        self.active_user = NonCallableMock(spec=[], is_active=True)
        self.inactive_user = NonCallableMock(spec=[], is_active=False)
        self.users = [self.active_user, self.inactive_user]

    def test_authenticate(self):
        """
        `authenticate()` does nothing.
        """
        assert self.backend.authenticate() is None

    def test_get_user(self):
        """
        `get_user()` does nothing.
        """
        for user_id in [None, 1, 'foo']:
            assert self.backend.get_user(user_id) is None

    def test_get_permissions(self):
        """
        The ``get_*_permissions()`` methods return no permissions.
        """
        permission_methods = [
            self.backend.get_user_permissions,
            self.backend.get_group_permissions,
            self.backend.get_all_permissions,
        ]
        users = [self.active_user, self.inactive_user]
        for method in permission_methods:
            for user in users:
                assert method(user) == set()
                assert method(user, None) == set()
                assert method(user, object()) == set()

    def test_has_perm(self):
        """
        `has_perm()` always returns false.
        """
        for user in self.users:
            for perm in [None, '', 'dummy']:
                assert self.backend.has_perm(user, perm) is False
                assert self.backend.has_perm(user, perm, None) is False
                assert self.backend.has_perm(user, perm, object()) is False

    def test_has_module_perms(self):
        """
        `has_module_perm()` always returns false.
        """
        for user in self.users:
            for app_label in [None, '', 'dummy', 'app.perm']:
                assert self.backend.has_module_perms(user, app_label) is False
 def setUp(self):
     self.backend = BaseAuthorizationBackend()
     self.active_user = NonCallableMock(spec=[], is_active=True)
     self.inactive_user = NonCallableMock(spec=[], is_active=False)
     self.users = [self.active_user, self.inactive_user]