Beispiel #1
0
 def setUp(self):
     self.testbed = testbed.Testbed()
     self.testbed.activate()
     self.testbed.init_taskqueue_stub()
     self.taskqueue_stub = self.testbed.get_stub(
         testbed.TASKQUEUE_SERVICE_NAME)
     self.taskqueue_stub._root_path = os.path.dirname(
         os.path.dirname(os.path.dirname(__file__)))
     self.services = service_manager.Services(
         user=fake.UserService(),
         usergroup=fake.UserGroupService(),
         project=fake.ProjectService(),
         config=fake.ConfigService(),
         issue=fake.IssueService(),
         issue_star=fake.IssueStarService(),
         features=fake.FeaturesService())
     self.services.user.TestAddUser('*****@*****.**', 1)
     self.services.user.TestAddUser('*****@*****.**', 2)
     self.services.user.TestAddUser('*****@*****.**', 3)
     self.services.project.TestAddProject('test-project',
                                          owner_ids=[1, 3],
                                          project_id=12345)
     self.issue1 = MakeTestIssue(project_id=12345,
                                 local_id=1,
                                 owner_id=2,
                                 reporter_id=1)
     self.services.issue.TestAddIssue(self.issue1)
Beispiel #2
0
 def setUp(self):
     self.services = service_manager.Services(project=fake.ProjectService(),
                                              user=fake.UserService())
     self.project = self.services.project.TestAddProject('project')
     self.services.user.TestAddUser('*****@*****.**', 111L)
     self.services.user.TestAddUser('*****@*****.**', 222L)
     self.services.user.TestAddUser('*****@*****.**', 555L)
    def setUp(self):
        self.services = service_manager.Services(
            config=fake.ConfigService(),
            issue=fake.IssueService(),
            user=fake.UserService(),
            project=fake.ProjectService(),
        )

        self.project_name = 'proj'
        self.project_id = 987
        self.project = self.services.project.TestAddProject(
            self.project_name,
            project_id=self.project_id,
            process_inbound_email=True)

        self.issue_id = 11
        self.issue_local_id = 100
        self.issue = tracker_pb2.Issue()
        self.issue.issue_id = self.issue_id
        self.issue.project_id = self.project_id
        self.issue.local_id = self.issue_local_id
        self.services.issue.TestAddIssue(self.issue)

        self.comment_id = 123
        self.comment_timestamp = 120
        self.user_id = 2
        self.mr_after = 1234

        self.mox = mox.Mox()
Beispiel #4
0
 def setUp(self):
     self.users_by_id = {
         111L: framework_views.StuffUserView(111L, '*****@*****.**',
                                             True),
         222L: framework_views.StuffUserView(222L, '*****@*****.**',
                                             True),
         999L: framework_views.StuffUserView(999L, '*****@*****.**',
                                             True),
     }
     self.services = service_manager.Services(
         project=fake.ProjectService(),
         config=fake.ConfigService(),
         issue=fake.IssueService(),
         user=fake.UserService(),
         usergroup=fake.UserGroupService())
     self.owner = self.services.user.TestAddUser('*****@*****.**', 111L)
     self.member = self.services.user.TestAddUser('*****@*****.**',
                                                  222L)
     self.visitor = self.services.user.TestAddUser('*****@*****.**',
                                                   999L)
     self.project = self.services.project.TestAddProject(
         'proj', owner_ids=[111L], committer_ids=[222L])
     self.project.process_inbound_email = True
     self.issue = fake.MakeTestIssue(self.project.project_id, 1, 'summary',
                                     'New', 111L)
Beispiel #5
0
    def setUp(self):
        self.project_service = fake.ProjectService()
        self.issue_service = fake.IssueService()
        self.issue_star_service = fake.IssueStarService()
        self.config_service = fake.ConfigService()
        self.features_service = fake.FeaturesService()
        self.project_star_service = fake.ProjectStarService()
        self.services = service_manager.Services(
            project=self.project_service,
            issue=self.issue_service,
            issue_star=self.issue_star_service,
            config=self.config_service,
            features=self.features_service,
            project_star=self.project_star_service,
            template=Mock(spec=template_svc.TemplateService),
            user=fake.UserService(),
            usergroup=fake.UserGroupService())

        self.proj1_id = 1001
        self.proj1_issue_id = 111
        self.proj1 = self.project_service.TestAddProject(
            name='proj1', project_id=self.proj1_id)
        self.proj2_id = 1002
        self.proj2_issue_id = 112
        self.proj2 = self.project_service.TestAddProject(
            name='proj2', project_id=self.proj2_id)

        self.mox = mox.Mox()
        self.cnxn = self.mox.CreateMock(sql.MonorailConnection)
        self.project_service.project_tbl = self.mox.CreateMock(
            sql.SQLTableManager)
        self.issue_service.issue_tbl = self.mox.CreateMock(sql.SQLTableManager)
    def setUp(self):
        self.services = service_manager.Services(
            project=fake.ProjectService(),
            config=fake.ConfigService(),
            usergroup=fake.UserGroupService(),
            issue=fake.IssueService(),
            issue_star=fake.IssueStarService(),
            cache_manager=fake.CacheManager(),
            features=fake.FeaturesService(),
            user=fake.UserService())
        self.servlet = issuelist.IssueList('req',
                                           'res',
                                           services=self.services)
        self.project = self.services.project.TestAddProject('proj')
        self.issue1 = fake.MakeTestIssue(1,
                                         1,
                                         'issue_summary',
                                         'New',
                                         111,
                                         project_name='proj')
        self.services.issue.TestAddIssue(self.issue1)
        self.mr = testing_helpers.MakeMonorailRequest(project=self.project)
        self.mr.project_name = self.project.project_name
        self.mr.auth.effective_ids = {111}
        self.mr.me_user_id = 111

        self.testbed = testbed.Testbed()
        self.testbed.activate()
        self.testbed.init_memcache_stub()
        self.testbed.init_datastore_v3_stub()
 def setUp(self):
     self.services = service_manager.Services(
         project=fake.ProjectService(),
         user=fake.UserService(),
         project_star=fake.ProjectStarService())
     self.projects_json_feed = userprojects.ProjectsJsonFeed(
         'req', 'res', services=self.services)
  def setUp(self):
    self.mox = mox.Mox()
    self.testbed = testbed.Testbed()
    self.testbed.activate()
    self.testbed.init_memcache_stub()
    self.testbed.init_app_identity_stub()
    self.testbed.init_urlfetch_stub()
    self.attachment_data = ""

    self._old_gcs_open = cloudstorage.open
    cloudstorage.open = fake.gcs_open

    services = service_manager.Services(
        project=fake.ProjectService(),
        config=fake.ConfigService(),
        issue=fake.IssueService(),
        user=fake.UserService())
    self.project = services.project.TestAddProject('proj')
    self.servlet = issueattachment.AttachmentPage(
        'req', webapp2.Response(), services=services)
    self.issue = fake.MakeTestIssue(
        self.project.project_id, 1, 'summary', 'New', 111L)
    services.issue.TestAddIssue(self.issue)
    self.comment = tracker_pb2.IssueComment(
        id=123, issue_id=self.issue.issue_id,
        project_id=self.project.project_id, user_id=111L,
        content='this is a comment')
    services.issue.TestAddComment(self.comment, self.issue.local_id)
    self.attachment = tracker_pb2.Attachment(
        attachment_id=54321, filename='hello.txt', filesize=23432,
        mimetype='text/plain', gcs_object_id='/pid/attachments/hello.txt')
    services.issue.TestAddAttachment(
        self.attachment, self.comment.id, self.issue.issue_id)
 def setUp(self):
     self.mox = mox.Mox()
     self.cnxn = fake.MonorailConnection()
     self.services = service_manager.Services(
         config=fake.ConfigService(),
         issue=fake.IssueService(),
         user=fake.UserService(),
         user_star=fake.UserStarService(),
         usergroup=fake.UserGroupService(),
         project=fake.ProjectService(),
         project_star=fake.ProjectStarService(),
         features=fake.FeaturesService())
     self.project = self.services.project.TestAddProject('proj',
                                                         project_id=987)
     self.user = self.services.user.TestAddUser('*****@*****.**', 111)
     self.user_2 = self.services.user.TestAddUser('*****@*****.**', 222)
     self.group1_id = self.services.usergroup.CreateGroup(
         self.cnxn, self.services, '*****@*****.**', 'anyone')
     self.group2_id = self.services.usergroup.CreateGroup(
         self.cnxn, self.services, '*****@*****.**', 'anyone')
     self.services.usergroup.UpdateMembers(self.cnxn, self.group1_id, [111],
                                           'member')
     self.services.usergroup.UpdateMembers(self.cnxn, self.group2_id,
                                           [222, 111], 'owner')
     self.users_svcr = users_servicer.UsersServicer(self.services,
                                                    make_rate_limiter=False)
     self.prpc_context = context.ServicerContext()
     self.prpc_context.set_code(codes.StatusCode.OK)
  def setUp(self):
    self.cnxn = 'fake cnxn'
    self.services = service_manager.Services(
        user=fake.UserService(),
        usergroup=fake.UserGroupService(),
        project=fake.ProjectService(),
        issue=fake.IssueService(),
        config=fake.ConfigService(),
        cache_manager=fake.CacheManager())
    self.profiler = profiler.Profiler()
    self.services.user.TestAddUser('*****@*****.**', 111L)
    self.project = self.services.project.TestAddProject('proj', project_id=789)
    self.mr = testing_helpers.MakeMonorailRequest(
      path='/p/proj/issues/list?q=Priority:High',
      project=self.project)
    self.mr.me_user_id = 999L  # This value is not used by backend search
    self.mr.shard_id = 2
    self.mr.invalidation_timestep = 12345

    self.mox = mox.Mox()
    self.testbed = testbed.Testbed()
    self.testbed.activate()
    self.testbed.init_user_stub()
    self.testbed.init_memcache_stub()
    sorting.InitializeArtValues(self.services)
Beispiel #11
0
    def setUp(self):
        self.services = service_manager.Services(user=fake.UserService(),
                                                 issue=fake.IssueService(),
                                                 config=fake.ConfigService(),
                                                 project=fake.ProjectService())
        self.servlet = componentdetail.ComponentDetail('req',
                                                       'res',
                                                       services=self.services)
        self.project = self.services.project.TestAddProject('proj')
        self.mr = testing_helpers.MakeMonorailRequest(
            project=self.project, perms=permissions.OWNER_ACTIVE_PERMISSIONSET)
        self.mr.auth.email = '*****@*****.**'
        self.config = self.services.config.GetProjectConfig(
            'fake cnxn', self.project.project_id)
        self.services.config.StoreConfig('fake cnxn', self.config)
        self.cd = tracker_bizobj.MakeComponentDef(1, self.project.project_id,
                                                  'BackEnd', 'doc', False, [],
                                                  [111L], 100000, 122L,
                                                  10000000, 133L)
        self.config.component_defs = [self.cd]
        self.services.user.TestAddUser('*****@*****.**', 111L)
        self.services.user.TestAddUser('*****@*****.**', 122L)
        self.services.user.TestAddUser('*****@*****.**', 133L)
        self.mr.component_path = 'BackEnd'

        self.mox = mox.Mox()
Beispiel #12
0
  def setUp(self):
    services = service_manager.Services(
        project=fake.ProjectService(),
        config=fake.ConfigService(),
        issue=fake.IssueService(),
        user=fake.UserService(),
        usergroup=fake.UserGroupService())
    services.user.TestAddUser('*****@*****.**', 111L)
    services.user.TestAddUser('*****@*****.**', 222L)
    services.user.TestAddUser('*****@*****.**', 333L)
    services.user.TestAddUser('*****@*****.**', 666L)

    # User group 888 has members: user_555 and [email protected]
    services.user.TestAddUser('*****@*****.**', 888L)
    services.usergroup.TestAddGroupSettings(888L, '*****@*****.**')
    services.usergroup.TestAddMembers(888L, [555L, 1001L])

    # User group 999 has members: user_111 and user_444
    services.user.TestAddUser('*****@*****.**', 999L)
    services.usergroup.TestAddGroupSettings(999L, '*****@*****.**')
    services.usergroup.TestAddMembers(999L, [111L, 444L])

    self.project = services.project.TestAddProject('proj')
    self.project.owner_ids.extend([111L])
    self.project.committer_ids.extend([222L])
    self.project.contributor_ids.extend([333L])
    self.servlet = issueoptions.IssueOptionsJSON(
        'req', webapp2.Response(), services=services)

    self.services = services
Beispiel #13
0
    def setUp(self):
        self.testbed = testbed.Testbed()
        self.testbed.activate()
        self.testbed.init_taskqueue_stub()
        self.taskqueue_stub = self.testbed.get_stub(
            testbed.TASKQUEUE_SERVICE_NAME)
        self.taskqueue_stub._root_path = os.path.dirname(
            os.path.dirname(os.path.dirname(__file__)))
        self.services = service_manager.Services(
            user=fake.UserService(),
            usergroup=fake.UserGroupService(),
            project=fake.ProjectService(),
            config=fake.ConfigService(),
            issue=fake.IssueService(),
            issue_star=fake.IssueStarService(),
            features=fake.FeaturesService())
        self.services.user.TestAddUser('*****@*****.**', 1)
        self.services.user.TestAddUser('*****@*****.**', 2)
        self.services.user.TestAddUser('*****@*****.**', 3)
        self.services.project.TestAddProject('test-project',
                                             owner_ids=[1, 3],
                                             project_id=12345)
        self.issue1 = MakeTestIssue(project_id=12345,
                                    local_id=1,
                                    owner_id=2,
                                    reporter_id=1)
        self.services.issue.TestAddIssue(self.issue1)

        self._old_gcs_open = cloudstorage.open
        cloudstorage.open = fake.gcs_open
        self.orig_sign_attachment_id = attachment_helpers.SignAttachmentID
        attachment_helpers.SignAttachmentID = (lambda aid: 'signed_%d' % aid)
  def setUp(self):
    self.mox = mox.Mox()
    self.testbed = testbed.Testbed()
    self.testbed.activate()
    self.testbed.init_memcache_stub()
    self.testbed.init_datastore_v3_stub()
    self.testbed.init_user_stub()

    self.cnxn = fake.MonorailConnection()
    self.services = service_manager.Services(
        user=fake.UserService(),
        usergroup=fake.UserGroupService(),
        project=fake.ProjectService(),
        cache_manager=fake.CacheManager())
    self.project = self.services.project.TestAddProject(
        'proj', project_id=789, owner_ids=[111])
    self.user = self.services.user.TestAddUser('*****@*****.**', 222)
    self.svcr = TestableServicer(self.services)
    self.token = xsrf.GenerateToken(222, xsrf.XHR_SERVLET_PATH)
    self.request = UpdateSomethingRequest(exc_class=None)
    self.prpc_context = context.ServicerContext()
    self.prpc_context.set_code(codes.StatusCode.OK)
    self.auth = authdata.AuthData(user_id=222, email='*****@*****.**')

    self.oauth_patcher = mock.patch(
        'google.appengine.api.oauth.get_current_user')
    self.mock_oauth_gcu = self.oauth_patcher.start()
    self.mock_oauth_gcu.return_value = None
Beispiel #15
0
  def setUp(self):
    self.services = service_manager.Services(
        features=fake.FeaturesService(),
        project=fake.ProjectService(),
        config=fake.ConfigService(),
        issue=fake.IssueService(),
        issue_star=fake.IssueStarService(),
        user=fake.UserService(),
        usergroup=fake.UserGroupService())
    self.servlet = issuebulkedit.IssueBulkEdit(
        'req', 'res', services=self.services)
    self.mr = testing_helpers.MakeMonorailRequest(
        perms=permissions.OWNER_ACTIVE_PERMISSIONSET)
    self.project = self.services.project.TestAddProject(
        name='proj', project_id=789, owner_ids=[111])
    self.cnxn = 'fake connection'
    self.config = self.services.config.GetProjectConfig(
        self.cnxn, self.project.project_id)
    self.services.config.StoreConfig(self.cnxn, self.config)
    self.owner = self.services.user.TestAddUser('*****@*****.**', 111)

    self.testbed = testbed.Testbed()
    self.testbed.activate()
    self.testbed.init_taskqueue_stub()
    self.testbed.init_memcache_stub()
    self.testbed.init_datastore_v3_stub()
    self.taskqueue_stub = self.testbed.get_stub(testbed.TASKQUEUE_SERVICE_NAME)
    self.taskqueue_stub._root_path = os.path.dirname(
        os.path.dirname(os.path.dirname( __file__ )))

    self.mocked_methods = {}
Beispiel #16
0
    def setUp(self):
        self.cnxn = 'fake cnxn'
        self.services = service_manager.Services(
            issue=fake.IssueService(),
            user=fake.UserService(),
            usergroup=fake.UserGroupService(),
            project=fake.ProjectService(),
            config=fake.ConfigService())

        self.member = self.services.user.TestAddUser('*****@*****.**', 111)
        self.outsider = self.services.user.TestAddUser('*****@*****.**',
                                                       222)
        self.project = self.services.project.TestAddProject(
            'proj',
            project_id=987,
            process_inbound_email=True,
            committer_ids=[self.member.user_id])
        self.issue = tracker_pb2.Issue()
        self.issue.issue_id = 98701
        self.issue.project_id = 987
        self.issue.local_id = 1
        self.issue.owner_id = 0
        self.issue.summary = 'summary'
        self.issue.status = 'Assigned'
        self.services.issue.TestAddIssue(self.issue)

        self.uia = commitlogcommands.UpdateIssueAction(self.issue.local_id)
Beispiel #17
0
 def setUpServlet(self, servlet_factory):
     # pylint: disable=attribute-defined-outside-init
     self.services = service_manager.Services(
         project=fake.ProjectService(),
         config=fake.ConfigService(),
         user=fake.UserService(),
         issue=fake.IssueService(),
         template=Mock(spec=template_svc.TemplateService),
         features=fake.FeaturesService())
     self.servlet = servlet_factory('req', 'res', services=self.services)
     self.project = self.services.project.TestAddProject('proj',
                                                         project_id=789,
                                                         contrib_ids=[333])
     self.config = tracker_bizobj.MakeDefaultProjectIssueConfig(789)
     self.services.config.StoreConfig(None, self.config)
     self.cnxn = fake.MonorailConnection()
     self.mr = testing_helpers.MakeMonorailRequest(path='/p/proj/admin',
                                                   project=self.project)
     self.mox = mox.Mox()
     self.test_template = tracker_bizobj.MakeIssueTemplate(
         'Test Template', 'sum', 'New', 111, 'content', [], [], [], [])
     self.test_template.template_id = 12345
     self.test_templates = testing_helpers.DefaultTemplates()
     self.test_templates.append(self.test_template)
     self.services.template.GetProjectTemplates\
         .return_value = self.test_templates
     self.services.template.GetTemplateSetForProject\
         .return_value = [(12345, 'Test template', 0)]
Beispiel #18
0
 def setUp(self):
     self.cnxn = 'fake sql connection'
     self.services = service_manager.Services(project=fake.ProjectService(),
                                              user=fake.UserService())
     self.services.user.TestAddUser('*****@*****.**', 111L)
     self.services.user.TestAddUser('*****@*****.**', 222L)
     self.services.user.TestAddUser('*****@*****.**', 333L)
Beispiel #19
0
def GetRequestObjects(headers=None,
                      path='/',
                      params=None,
                      payload=None,
                      user_info=None,
                      project=None,
                      method='GET',
                      perms=None,
                      services=None,
                      hotlist=None):
    """Make fake request and MonorailRequest objects for testing.

  Host param will override the 'Host' header, and has a default value of
  '127.0.0.1'.

  Args:
    headers: Dict of HTTP header strings.
    path: Path part of the URL in the request.
    params: Dict of query-string parameters.
    user_info: Dict of user attributes to set on a MonorailRequest object.
        For example, "user_id: 5" causes self.auth.user_id=5.
    project: optional Project object for the current request.
    method: 'GET' or 'POST'.
    perms: PermissionSet to use for this request.
    services: Connections to backends.
    hotlist: optional Hotlist object for the current request

  Returns:
    A tuple of (http Request, monorailrequest.MonorailRequest()).
  """
    headers = headers or {}
    params = params or {}

    headers.setdefault('Host', DEFAULT_HOST)
    post_items = None
    if method == 'POST' and payload:
        post_items = payload
    elif method == 'POST' and params:
        post_items = params

    if not services:
        services = service_manager.Services(project=fake.ProjectService(),
                                            user=fake.UserService(),
                                            usergroup=fake.UserGroupService(),
                                            features=fake.FeaturesService())
        services.project.TestAddProject('proj')
        services.features.TestAddHotlist('hotlist')

    request = webapp2.Request.blank(path, headers=headers, POST=post_items)
    mr = fake.MonorailRequest(user_info=user_info,
                              project=project,
                              perms=perms,
                              params=params,
                              hotlist=hotlist)
    mr.ParseRequest(request,
                    services,
                    profiler.Profiler(),
                    do_user_lookups=False)
    mr.auth.user_pb = user_pb2.MakeUser(0)
    return request, mr
Beispiel #20
0
    def VerifyShouldShowFlipper(self,
                                expected,
                                query,
                                sort_spec,
                                can,
                                create_issues=0):
        """Instantiate a _Flipper and check if makes a pipeline or not."""
        services = service_manager.Services(config=fake.ConfigService(),
                                            issue=fake.IssueService(),
                                            project=fake.ProjectService(),
                                            user=fake.UserService())
        project = services.project.TestAddProject('proj',
                                                  project_id=987,
                                                  committer_ids=[111])
        mr = testing_helpers.MakeMonorailRequest(project=project)
        mr.query = query
        mr.sort_spec = sort_spec
        mr.can = can
        mr.project_name = project.project_name
        mr.project = project

        for idx in range(create_issues):
            _local_id, _ = services.issue.CreateIssue(
                self.cnxn, services, project.project_id, 'summary_%d' % idx,
                'status', 111, [], [], [], [], 111, 'description_%d' % idx)

        self.assertEqual(expected,
                         issuedetailezt._ShouldShowFlipper(mr, services))
Beispiel #21
0
    def setUp(self):
        self.cnxn = 'fake cnxn'
        self.services = service_manager.Services(
            config=fake.ConfigService(),
            issue=fake.IssueService(),
            user=fake.UserService(),
            usergroup=fake.UserGroupService(),
            project=fake.ProjectService())
        self.project = self.services.project.TestAddProject(
            'proj',
            project_id=987,
            process_inbound_email=True,
            contrib_ids=[111])
        self.project_addr = '*****@*****.**'

        self.issue = tracker_pb2.Issue()
        self.issue.project_id = 987
        self.issue.local_id = 100
        self.services.issue.TestAddIssue(self.issue)

        self.msg = testing_helpers.MakeMessage(testing_helpers.HEADER_LINES,
                                               'awesome!')

        request, _ = testing_helpers.GetRequestObjects()
        self.inbound = inboundemail.InboundEmail(request, None, self.services)
        self.mox = mox.Mox()
 def setUp(self):
   self.testbed = testbed.Testbed()
   self.testbed.activate()
   self.testbed.init_memcache_stub()
   self.testbed.init_datastore_v3_stub()
   self.services = service_manager.Services(
       issue_star=fake.IssueStarService(),
       config=fake.ConfigService(),
       user=fake.UserService(),
       issue=fake.IssueService(),
       project=fake.ProjectService(),
       cache_manager=fake.CacheManager(),
       features=fake.FeaturesService())
   self.servlet = hotlistissuescsv.HotlistIssuesCsv(
       'req', webapp2.Response(), services=self.services)
   self.user1 = self.services.user.TestAddUser('*****@*****.**', 111)
   self.user2 = self.services.user.TestAddUser('*****@*****.**', 222)
   self.services.project.TestAddProject('project-name', project_id=1)
   self.issue1 = fake.MakeTestIssue(
       1, 1, 'issue_summary', 'New', 111, project_name='project-name')
   self.services.issue.TestAddIssue(self.issue1)
   self.issues = [self.issue1]
   self.hotlist_item_fields = [
       (issue.issue_id, rank, 111, 1205079300, '') for
       rank, issue in enumerate(self.issues)]
   self.hotlist = self.services.features.TestAddHotlist(
       'MyHotlist', hotlist_id=123, owner_ids=[222], editor_ids=[111],
       hotlist_item_fields=self.hotlist_item_fields)
   self._MakeMR('/u/222/hotlists/MyHotlist')
   sorting.InitializeArtValues(self.services)
 def setUp(self):
     self.testbed = testbed.Testbed()
     self.testbed.activate()
     self.testbed.init_user_stub()
     self.testbed.init_memcache_stub()
     self.testbed.init_datastore_v3_stub()
     self.services = service_manager.Services(
         project=fake.ProjectService(),
         config=fake.ConfigService(),
         issue=fake.IssueService(),
         issue_star=fake.IssueStarService(),
         user=fake.UserService(),
         usergroup=fake.UserGroupService(),
         features=fake.FeaturesService(),
         spam=fake.SpamService())
     self.services.user.TestAddUser('*****@*****.**', 111)
     self.proj = self.services.project.TestAddProject('proj',
                                                      project_id=789)
     self.cnxn = 'fake cnxn'
     self.servlet = issuepeek.IssuePeek('req',
                                        'res',
                                        services=self.services)
     self.local_id_1, _ = self.services.issue.CreateIssue(
         self.cnxn, self.services, 789, 'summary', 'status', 111, [], [],
         [], [], 111, 'The screen is just dark when I press power on')
Beispiel #24
0
 def setUp(self):
     self.services = service_manager.Services(config=fake.ConfigService(),
                                              issue=fake.IssueService(),
                                              user=fake.UserService(),
                                              project=fake.ProjectService())
     self.servlet = issuetips.IssueSearchTips('req',
                                              'res',
                                              services=self.services)
Beispiel #25
0
 def setUp(self):
   self.services = service_manager.Services(
       user=fake.UserService(),
       usergroup=fake.UserGroupService(),
       project=fake.ProjectService())
   self.servlet = groupcreate.GroupCreate(
       'req', 'res', services=self.services)
   self.mr = testing_helpers.MakeMonorailRequest()
Beispiel #26
0
 def setUp(self):
     self.cnxn = 'fake cnxn'
     self.config = tracker_bizobj.MakeDefaultProjectIssueConfig(789)
     self.services = service_manager.Services(user=fake.UserService(),
                                              project=fake.ProjectService(),
                                              issue=fake.IssueService(),
                                              config=fake.ConfigService())
     self.services.user.TestAddUser('*****@*****.**', 111)
Beispiel #27
0
    def setUp(self):
        self.testbed = testbed.Testbed()
        self.testbed.activate()
        self.testbed.init_app_identity_stub()

        services = service_manager.Services(project=fake.ProjectService(),
                                            config=fake.ConfigService(),
                                            issue=fake.IssueService(),
                                            user=fake.UserService())
        self.project = services.project.TestAddProject('proj')
        self.servlet = issueattachmenttext.AttachmentText('req',
                                                          'res',
                                                          services=services)

        self.issue = tracker_pb2.Issue()
        self.issue.local_id = 1
        self.issue.issue_id = 1
        self.issue.summary = 'sum'
        self.issue.project_name = 'proj'
        self.issue.project_id = self.project.project_id
        services.issue.TestAddIssue(self.issue)

        self.comment0 = tracker_pb2.IssueComment()
        self.comment0.content = 'this is the description'
        self.comment1 = tracker_pb2.IssueComment()
        self.comment1.content = 'this is a comment'

        self.attach0 = tracker_pb2.Attachment(
            attachment_id=4567,
            filename='b.txt',
            mimetype='text/plain',
            gcs_object_id='/pid/attachments/abcd')
        self.comment0.attachments.append(self.attach0)

        self.attach1 = tracker_pb2.Attachment(
            attachment_id=1234,
            filename='a.txt',
            mimetype='text/plain',
            gcs_object_id='/pid/attachments/abcdefg')
        self.comment0.attachments.append(self.attach1)

        self.bin_attach = tracker_pb2.Attachment(
            attachment_id=2468,
            mimetype='application/octets',
            gcs_object_id='/pid/attachments/\0\0\0\0\0\1\2\3')
        self.comment1.attachments.append(self.bin_attach)

        self.comment0.project_id = self.project.project_id
        services.issue.TestAddComment(self.comment0, self.issue.local_id)
        self.comment1.project_id = self.project.project_id
        services.issue.TestAddComment(self.comment1, self.issue.local_id)
        services.issue.TestAddAttachment(self.attach0, self.comment0.id,
                                         self.issue.issue_id)
        services.issue.TestAddAttachment(self.attach1, self.comment1.id,
                                         self.issue.issue_id)
        # TODO(jrobbins): add tests for binary content
        self._old_gcs_open = cloudstorage.open
        cloudstorage.open = fake.gcs_open
Beispiel #28
0
 def setUp(self):
     services = service_manager.Services(project=fake.ProjectService())
     self.servlet = projectadminadvanced.ProjectAdminAdvanced(
         'req', 'res', services=services)
     self.project = services.project.TestAddProject('proj', owner_ids=[111])
     self.mr = testing_helpers.MakeMonorailRequest(
         project=self.project,
         perms=permissions.OWNER_ACTIVE_PERMISSIONSET,
         user_info={'user_id': 111})
 def setUp(self):
   self.services = service_manager.Services(
       user=fake.UserService(),
       issue=fake.IssueService(),
       project=fake.ProjectService(),
       config=fake.ConfigService(),
       issue_star=fake.IssueStarService())
   self.services.user.TestAddUser('*****@*****.**', 111)
   self.person_1 = api_pb2_v1_helpers.convert_person(111, None, self.services)
 def setUp(self):
     services = service_manager.Services(project=fake.ProjectService())
     self.servlet = projectadminadvanced.ProjectAdminAdvanced(
         'req', 'res', services=services)
     self.project = services.project.TestAddProject('proj')
     self.mr = testing_helpers.MakeMonorailRequest(
         project=self.project, perms=permissions.OWNER_ACTIVE_PERMISSIONSET)
     self.orig_time_function = time.time
     time.time = lambda: NOW