blob: 84750419ad38373f11328039a0a33ebcc8ab14c7 [file] [log] [blame]
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is govered by a BSD-style
# license that can be found in the LICENSE file or at
"""Unit tests for savedqueries feature."""
import unittest
from features import savedqueries
from framework import monorailrequest
from framework import permissions
from services import service_manager
from testing import fake
class SavedQueriesTest(unittest.TestCase):
def setUp(self): = service_manager.Services(
self.servlet = savedqueries.SavedQueries(
'req', 'res','', 111L)
def testAssertBasePermission(self):
"""Only permit site admins and users viewing themselves."""
mr = monorailrequest.MonorailRequest()
mr.viewed_user_auth.user_id = 111L
mr.auth.user_id = 222L
self.servlet.AssertBasePermission, mr)
mr.auth.user_id = 111L
mr.auth.user_id = 222L
mr.auth.user_pb.is_site_admin = True