def METHOD_NAME(self):
    query_db("INSERT INTO %s (username, password) VALUES ('a', '%s')" % (settings.AUTHENT_TABLENAME, password2md5('a')))
    user = self.backend.authenticate(username='a', password='a')
    self.assertFalse(user.is_superuser)
    def test_level(username, level, groups):
        query_db("UPDATE %s SET level = %s WHERE username = '%s'" % (settings.AUTHENT_TABLENAME, level, username))
        user = self.backend.authenticate(username='a', password='a')
        if user:
            usergroups = user.groups.all()
            for group in groups:
                self.assertTrue(Group.objects.get(id=group) in usergroups)
        return user
    user = test_level('a', 0, [])
    self.assertEqual(user, None)
    test_level('a', 2, [settings.AUTHENT_GROUPS_MAPPING['EDITOR']])
    test_level('a', 3, [settings.AUTHENT_GROUPS_MAPPING['PATH_MANAGER']])
    test_level('a', 4, [settings.AUTHENT_GROUPS_MAPPING['TREKKING_MANAGER']])
    test_level('a', 5, [settings.AUTHENT_GROUPS_MAPPING['EDITOR_TREKKING_MANAGEMENT']])
    user = test_level('a', 6, [])
    self.assertTrue(user.is_staff)
    self.assertTrue(user.is_superuser)