Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(338)

Side by Side Diff: appengine/monorail/features/test/savedqueries_test.py

Issue 1868553004: Open Source Monorail (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is govered by a BSD-style
3 # license that can be found in the LICENSE file or at
4 # https://developers.google.com/open-source/licenses/bsd
5
6 """Unit tests for savedqueries feature."""
7
8 import unittest
9
10 from features import savedqueries
11 from framework import monorailrequest
12 from framework import permissions
13 from services import service_manager
14 from testing import fake
15
16
17 class SavedQueriesTest(unittest.TestCase):
18
19 def setUp(self):
20 self.services = service_manager.Services(
21 user=fake.UserService())
22 self.servlet = savedqueries.SavedQueries(
23 'req', 'res', services=self.services)
24 self.services.user.TestAddUser('a@example.com', 111L)
25
26 def testAssertBasePermission(self):
27 """Only permit site admins and users viewing themselves."""
28 mr = monorailrequest.MonorailRequest()
29 mr.viewed_user_auth.user_id = 111L
30 mr.auth.user_id = 222L
31
32 self.assertRaises(permissions.PermissionException,
33 self.servlet.AssertBasePermission, mr)
34
35 mr.auth.user_id = 111L
36 self.servlet.AssertBasePermission(mr)
37
38 mr.auth.user_id = 222L
39 mr.auth.user_pb.is_site_admin = True
40 self.servlet.AssertBasePermission(mr)
OLDNEW
« no previous file with comments | « appengine/monorail/features/test/savedqueries_helpers_test.py ('k') | appengine/monorail/features/test/stars_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698