OLD | NEW |
(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 """Unittests for the issueimport servlet.""" |
| 7 |
| 8 import unittest |
| 9 |
| 10 from framework import permissions |
| 11 from services import service_manager |
| 12 from testing import testing_helpers |
| 13 from tracker import issueimport |
| 14 |
| 15 |
| 16 class IssueExportTest(unittest.TestCase): |
| 17 |
| 18 def setUp(self): |
| 19 self.services = service_manager.Services() |
| 20 self.servlet = issueimport.IssueImport( |
| 21 'req', 'res', services=self.services) |
| 22 |
| 23 def testAssertBasePermission(self): |
| 24 """Only site admins can import issues.""" |
| 25 mr = testing_helpers.MakeMonorailRequest( |
| 26 perms=permissions.OWNER_ACTIVE_PERMISSIONSET) |
| 27 self.assertRaises(permissions.PermissionException, |
| 28 self.servlet.AssertBasePermission, mr) |
| 29 mr.auth.user_pb.is_site_admin = True |
| 30 self.servlet.AssertBasePermission(mr) |
OLD | NEW |