def _callProcessFormData(self, post_data, index_issue_1=True): servlet = issuereindex.IssueReindex('req', 'res', services=self.services) mr = testing_helpers.MakeMonorailRequest(project=self.project) mr.cnxn = self.cnxn issue1 = fake.MakeTestIssue(project_id=self.project.project_id, local_id=1, summary='sum', status='New', owner_id=111L) issue1.project_name = self.project.project_name self.services.issue.TestAddIssue(issue1) self.mox.StubOutWithMock(tracker_fulltext, 'IndexIssues') if index_issue_1: tracker_fulltext.IndexIssues(self.cnxn, [issue1], self.services.user, self.services.issue, self.services.config) self.mox.ReplayAll() ret = servlet.ProcessFormData(mr, post_data) self.mox.VerifyAll() return ret
def testAssertBasePermission_WithAccess(self): # Owners and admins have permission to view this page. for permission in (permissions.OWNER_ACTIVE_PERMISSIONSET, permissions.ADMIN_PERMISSIONSET): request, mr = testing_helpers.GetRequestObjects( project=self.project, perms=permission) servlet = issuereindex.IssueReindex(request, 'res', services=self.services) servlet.AssertBasePermission(mr)
def testGatherPageData(self): servlet = issuereindex.IssueReindex('req', 'res', services=self.services) mr = testing_helpers.MakeMonorailRequest() mr.auto_submit = True ret = servlet.GatherPageData(mr) self.assertTrue(ret['auto_submit']) self.assertIsNone(ret['issue_tab_mode']) self.assertTrue(ret['page_perms'].CreateIssue)
def testAssertBasePermission_NoAccess(self): # Non-members and contributors do not have permission to view this page. for permission in (permissions.USER_PERMISSIONSET, permissions.COMMITTER_ACTIVE_PERMISSIONSET): request, mr = testing_helpers.GetRequestObjects( project=self.project, perms=permission) servlet = issuereindex.IssueReindex(request, 'res', services=self.services) with self.assertRaises(permissions.PermissionException) as cm: servlet.AssertBasePermission(mr) self.assertEqual('You are not allowed to administer this project', cm.exception.message)