Exemplo n.º 1
0
  def issues_list(self, request):
    """List issues for projects."""
    mar = self.mar_factory(request)

    if request.additionalProject:
      for project_name in request.additionalProject:
        project = self._services.project.GetProjectByName(
            mar.cnxn, project_name)
        if project and not permissions.UserCanViewProject(
            mar.auth.user_pb, mar.auth.effective_ids, project):
          raise permissions.PermissionException(
              'The user %s has no permission for project %s' %
              (mar.auth.email, project_name))
    prof = profiler.Profiler()
    pipeline = frontendsearchpipeline.FrontendSearchPipeline(
        mar, self._services, prof, mar.num)
    if not mar.errors.AnyErrors():
      pipeline.SearchForIIDs()
      pipeline.MergeAndSortIssues()
      pipeline.Paginate()
    else:
      raise endpoints.BadRequestException(mar.errors.query)

    issue_list = [
        api_pb2_v1_helpers.convert_issue(
            api_pb2_v1.IssueWrapper, r, mar, self._services)
        for r in pipeline.visible_results]
    return api_pb2_v1.IssuesListResponse(
        kind='monorail#issueList',
        totalResults=pipeline.total_count,
        items=issue_list)
Exemplo n.º 2
0
    def __init__(self,
                 services,
                 cnxn=None,
                 requester=None,
                 auth=None,
                 perms=None,
                 autocreate=True):
        """Construct a MonorailContext.

    Args:
      services: Connection to backends.
      cnxn: Optional connection to SQL database.
      requester: String email address of user making the request or None.
      auth: AuthData object used during testing.
      perms: PermissionSet used during testing.
      autocreate: Set to False to require that a row in the User table already
          exists for this user, otherwise raise NoSuchUserException.
    """
        self.cnxn = cnxn or sql.MonorailConnection()
        self.auth = auth or authdata.AuthData.FromEmail(
            self.cnxn, requester, services, autocreate=autocreate)
        self.perms = perms  # Usually None until LookupLoggedInUserPerms() called.
        self.profiler = profiler.Profiler()

        # TODO(jrobbins): make self.errors not be UI-centric.
        self.warnings = []
        self.errors = template_helpers.EZTError()
Exemplo n.º 3
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
Exemplo n.º 4
0
 def testSinglePhase_SuperLongName(self):
     prof = profiler.Profiler()
     self.assertEquals(prof.current_phase.name, 'overall profile')
     long_name = 'x' * 1000
     with prof.Phase(long_name):
         self.assertEquals('x' * profiler.MAX_PHASE_NAME_LENGTH,
                           prof.current_phase.name)
  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)
Exemplo n.º 6
0
 def testAssignFlipperValues_NoShow(self):
     one_issue_hotlist = fake.Hotlist('name1', 122,
                                      [self.hotlist_item_fields[0]])
     no_show_hotlist_flipper = issuedetail._HotlistFlipper(
         self.services, profiler.Profiler(), one_issue_hotlist)
     no_show_hotlist_flipper.AssignFlipperValues(self.mr, None, 0, None, 1)
     self.assertFalse(no_show_hotlist_flipper.show)
 def testCreateHotlistTableData_EndPagination(self):
     self.setUpCreateHotlistTableDataTestMR(hotlist=self.test_hotlist,
                                            path='/123?num=2&start=2')
     table_data, _ = hotlist_helpers.CreateHotlistTableData(
         self.mr, self.hotlist_items_list, profiler.Profiler(),
         self.services)
     self.assertEqual(len(table_data), 1)
Exemplo n.º 8
0
 def testSinglePhase(self):
     prof = profiler.Profiler()
     self.assertEquals(prof.current_phase.name, 'overall profile')
     with prof.Phase('test'):
         self.assertEquals(prof.current_phase.name, 'test')
         self.assertEquals(prof.current_phase.parent.name,
                           'overall profile')
     self.assertEquals(prof.current_phase.name, 'overall profile')
     self.assertEquals(prof.next_color, 1)
Exemplo n.º 9
0
    def MakeRequestAsUser(self, project_name, email):
        self.mox.StubOutWithMock(users, 'get_current_user')
        users.get_current_user().AndReturn(
            testing_helpers.Blank(email=lambda: email))
        self.mox.ReplayAll()

        request = webapp2.Request.blank('/p/' + project_name)
        mr = monorailrequest.MonorailRequest()
        prof = profiler.Profiler()
        with prof.Phase('parse user info'):
            mr.ParseRequest(request, self.services, prof)
        return mr
Exemplo n.º 10
0
  def TestPipeline(self, expected_last, expected_len):
    mr = testing_helpers.MakeMonorailRequest()

    mr.can = 1
    prof = profiler.Profiler()

    pipeline = projectsearch.ProjectSearchPipeline(mr, self.services, prof)
    pipeline.SearchForIDs()
    pipeline.GetProjectsAndPaginate('fake cnxn', '/hosting/search')
    self.assertEqual(1, pipeline.pagination.start)
    self.assertEqual(expected_last, pipeline.pagination.last)
    self.assertEqual(expected_len, len(pipeline.visible_results))

    return pipeline
Exemplo n.º 11
0
 def testSubphaseExecption(self):
     prof = profiler.Profiler()
     try:
         with prof.Phase('foo'):
             with prof.Phase('bar'):
                 pass
             with prof.Phase('baz'):
                 raise Exception('whoops')
     except Exception as e:
         self.assertEquals(e.message, 'whoops')
     finally:
         self.assertEquals(prof.current_phase.name, 'overall profile')
         self.assertEquals(prof.top_phase.subphases[0].subphases[1].name,
                           'baz')
Exemplo n.º 12
0
    def setUp(self):
        self.services = service_manager.Services(
            project=fake.ProjectService(),
            user=fake.UserService(),
            usergroup=fake.UserGroupService(),
            features=fake.FeaturesService())
        self.project = self.services.project.TestAddProject('proj')
        self.hotlist = self.services.features.TestAddHotlist('TestHotlist',
                                                             owner_ids=[111])
        self.services.user.TestAddUser('*****@*****.**', 111)

        self.profiler = profiler.Profiler()
        self.mox = mox.Mox()
        self.mox.StubOutWithMock(users, 'get_current_user')
        users.get_current_user().AndReturn(None)
        self.mox.ReplayAll()
    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(),
            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', project=self.project)
        self.mr.me_user_id = 111L

        self.issue_1 = fake.MakeTestIssue(789,
                                          1,
                                          'one',
                                          'New',
                                          111L,
                                          labels=['Priority-High'])
        self.services.issue.TestAddIssue(self.issue_1)
        self.issue_2 = fake.MakeTestIssue(789,
                                          2,
                                          'two',
                                          'New',
                                          111L,
                                          labels=['Priority-Low'])
        self.services.issue.TestAddIssue(self.issue_2)
        self.issue_3 = fake.MakeTestIssue(789,
                                          3,
                                          'three',
                                          'New',
                                          111L,
                                          labels=['Priority-Medium'])
        self.services.issue.TestAddIssue(self.issue_3)
        self.mr.sort_spec = 'Priority'

        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)
Exemplo n.º 14
0
    def testActivities_NoUpdates(self):
        mr = testing_helpers.MakeMonorailRequest()
        updates_data = activities.GatherUpdatesData(
            self.services,
            mr,
            profiler.Profiler(),
            project_ids=[self.project_id],
            user_ids=None,
            ending=None,
            updates_page_url=None,
            autolink=None,
            highlight=None)

        self.assertIsNone(updates_data['pagination'])
        self.assertIsNone(updates_data['no_stars'])
        self.assertIsNone(updates_data['updates_data'])
        self.assertEqual('yes', updates_data['no_activities'])
        self.assertIsNone(updates_data['ending_type'])
Exemplo n.º 15
0
    def testCreateHotlistTableData(self):
        self.setUpCreateHotlistTableDataTestMR(hotlist=self.test_hotlist)
        table_data, table_related_dict = hotlist_helpers.CreateHotlistTableData(
            self.mr, self.hotlist_items_list, profiler.Profiler(),
            self.services)
        self.assertEqual(len(table_data), 3)
        start_index = 100001
        for row in table_data:
            self.assertEqual(row.project_name, 'ProjectName')
            self.assertEqual(row.issue_id, start_index)
            start_index += 1
        self.assertEqual(len(table_related_dict['column_values']), 3)

        # test none of the shown columns show up in unshown_columns
        self.assertTrue(
            set(self.mr.col_spec.split()).isdisjoint(
                table_related_dict['unshown_columns']))
        self.assertEqual(table_related_dict['is_cross_project'], False)
        self.assertEqual(len(table_related_dict['pagination'].visible_results),
                         3)
Exemplo n.º 16
0
    def testReportCloudTrace(self):
        mock_trace_api = MockCloudTraceApi()
        mock_trace_context = '1234/5678;xxxxx'

        prof = profiler.Profiler(mock_trace_context, mock_trace_api)
        with prof.Phase('foo'):
            with prof.Phase('bar'):
                pass
            with prof.Phase('baz'):
                pass

        # Shouldn't this be automatic?
        prof.current_phase.End()

        self.assertEquals(prof.current_phase.name, 'overall profile')
        self.assertEquals(prof.top_phase.subphases[0].subphases[1].name, 'baz')

        prof.ReportTrace()
        self.assertEquals(mock_trace_api.mock_projects.project_id,
                          'testing-app')
Exemplo n.º 17
0
    def __init__(self,
                 request,
                 response,
                 services=None,
                 content_type='text/html; charset=UTF-8'):
        """Load and parse the template, saving it for later use."""
        super(Servlet, self).__init__(request, response)
        if self._PAGE_TEMPLATE:  # specified in subclasses
            template_path = self._TEMPLATE_PATH + self._PAGE_TEMPLATE
            self.template = template_helpers.GetTemplate(
                template_path,
                eliminate_blank_lines=self._ELIMINATE_BLANK_LINES)
        else:
            self.template = None

        self._missing_permissions_template = template_helpers.MonorailTemplate(
            self._TEMPLATE_PATH + self._MISSING_PERMISSIONS_TEMPLATE)
        self.services = services or self.app.config.get('services')
        self.content_type = content_type
        self.profiler = profiler.Profiler()
        self.mr = None
        self.ratelimiter = ratelimiter.RateLimiter()
  def setUp(self):
    self.cnxn = 'fake cnxn'
    self.config = tracker_bizobj.MakeDefaultProjectIssueConfig(789)
    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.mox = mox.Mox()
    self.testbed = testbed.Testbed()
    self.testbed.activate()
    self.testbed.init_user_stub()
    self.testbed.init_memcache_stub()
Exemplo n.º 19
0
    def setUp(self):
        self.services = service_manager.Services(config=fake.ConfigService(),
                                                 issue=fake.IssueService(),
                                                 user=fake.UserService(),
                                                 project=fake.ProjectService())
        self.mr = testing_helpers.MakeMonorailRequest()

        issue1 = fake.MakeTestIssue(001,
                                    1,
                                    'issue_summary',
                                    'New',
                                    111L,
                                    project_name='project1',
                                    issue_id=1L)
        self.services.issue.TestAddIssue(issue1)
        issue2 = fake.MakeTestIssue(001,
                                    2,
                                    'issue_summary',
                                    'New',
                                    111L,
                                    project_name='project1',
                                    issue_id=2L)
        self.services.issue.TestAddIssue(issue2)
        issue3 = fake.MakeTestIssue(002,
                                    3,
                                    'issue_summary',
                                    'New',
                                    111L,
                                    project_name='project2',
                                    issue_id=3L)
        self.services.issue.TestAddIssue(issue3)
        ts = 20091111111111
        self.hotlist_item_fields = [(1L, 10, 111L, ts, ''),
                                    (2L, 20, 111L, ts, ''),
                                    (3L, 30, 111L, ts, '')]
        self.hotlist = fake.Hotlist('name', 123, self.hotlist_item_fields)
        self.hotlist_flipper = issuedetail._HotlistFlipper(
            self.services, profiler.Profiler(), self.hotlist)
Exemplo n.º 20
0
    def testSpanJson(self):
        mock_trace_api = MockCloudTraceApi()
        mock_trace_context = '1234/5678;xxxxx'

        prof = profiler.Profiler(mock_trace_context, mock_trace_api)
        with prof.Phase('foo'):
            with prof.Phase('bar'):
                pass
            with prof.Phase('baz'):
                pass

        # Shouldn't this be automatic?
        prof.current_phase.End()

        self.assertEquals(prof.current_phase.name, 'overall profile')
        self.assertEquals(prof.top_phase.subphases[0].subphases[1].name, 'baz')
        span_json = prof.top_phase.SpanJson()
        self.assertEquals(len(span_json), 4)

        for span in span_json:
            self.assertTrue(span['endTime'] > span['startTime'])

        # pylint: disable=unbalanced-tuple-unpacking
        span1, span2, span3, span4 = span_json

        self.assertEquals(span1['name'], 'overall profile')
        self.assertEquals(span2['name'], 'foo')
        self.assertEquals(span3['name'], 'bar')
        self.assertEquals(span4['name'], 'baz')

        self.assertTrue(span1['startTime'] < span2['startTime'])
        self.assertTrue(span1['startTime'] < span3['startTime'])
        self.assertTrue(span1['startTime'] < span4['startTime'])

        self.assertTrue(span1['endTime'] > span2['endTime'])
        self.assertTrue(span1['endTime'] > span3['endTime'])
        self.assertTrue(span1['endTime'] > span4['endTime'])
Exemplo n.º 21
0
  def testConvertIssue(self):
    """Convert an internal Issue PB to an IssueWrapper API PB."""
    self.services.project.TestAddProject(
        'test-project', owner_ids=[2], project_id=12345)
    self.services.user.TestAddUser('*****@*****.**', 111)

    mar = mock.Mock()
    mar.cnxn = None
    mar.project_name = 'test-project'
    mar.project_id = 12345
    mar.auth.effective_ids = {111}
    mar.perms = permissions.READ_ONLY_PERMISSIONSET
    mar.profiler = profiler.Profiler()
    mar.config = tracker_bizobj.MakeDefaultProjectIssueConfig(12345)
    mar.config.field_defs = [
        tracker_bizobj.MakeFieldDef(
            1, 12345, 'EstDays', tracker_pb2.FieldTypes.INT_TYPE, None, None,
            False, False, False, None, None, None, False, None, None, None,
            None, 'doc', False, approval_id=2),
        tracker_bizobj.MakeFieldDef(
            2, 12345, 'DesignReview', tracker_pb2.FieldTypes.APPROVAL_TYPE,
            None, None, False, False, False, None, None, None, False, None,
            None, None, None, 'doc', False),
        tracker_bizobj.MakeFieldDef(
            3, 12345, 'StringField', tracker_pb2.FieldTypes.STR_TYPE, None,
            None, False, False, False, None, None, None, False, None, None,
            None, None, 'doc', False),
        tracker_bizobj.MakeFieldDef(
            4, 12345, 'DressReview', tracker_pb2.FieldTypes.APPROVAL_TYPE,
            None, None, False, False, False, None, None, None, False, None,
            None, None, None, 'doc', False),
        ]
    self.services.config.StoreConfig(mar.cnxn, mar.config)

    now = 1472067725
    now_dt = datetime.datetime.fromtimestamp(now)

    fvs = [
      tracker_bizobj.MakeFieldValue(
          1, 4, None, None, None, None, False, phase_id=4),
      tracker_bizobj.MakeFieldValue(
          3, None, 'string', None, None, None, False, phase_id=4),
      # missing phase
      tracker_bizobj.MakeFieldValue(
          3, None, u'\xe2\x9d\xa4\xef\xb8\x8f', None, None, None, False,
          phase_id=2),
    ]
    phases = [
        tracker_pb2.Phase(phase_id=3, name="JustAPhase", rank=4),
        tracker_pb2.Phase(phase_id=4, name="NotAPhase", rank=9)
        ]
    approval_values = [
        tracker_pb2.ApprovalValue(
            approval_id=2, phase_id=3, approver_ids=[111]),
        tracker_pb2.ApprovalValue(approval_id=4, approver_ids=[111])
    ]
    issue = fake.MakeTestIssue(
        12345, 1, 'one', 'New', 111, field_values=fvs,
        approval_values=approval_values, phases=phases)
    issue.opened_timestamp = now
    issue.owner_modified_timestamp = now
    issue.status_modified_timestamp = now
    issue.component_modified_timestamp = now
    # TODO(jrobbins): set up a lot more fields.

    for cls in [api_pb2_v1.IssueWrapper, api_pb2_v1.IssuesGetInsertResponse]:
      result = api_pb2_v1_helpers.convert_issue(cls, issue, mar, self.services)
      self.assertEquals(1, result.id)
      self.assertEquals('one', result.title)
      self.assertEquals('one', result.summary)
      self.assertEquals(now_dt, result.published)
      self.assertEquals(now_dt, result.owner_modified)
      self.assertEquals(now_dt, result.status_modified)
      self.assertEquals(now_dt, result.component_modified)
      self.assertEquals(
          result.fieldValues,
          [api_pb2_v1.FieldValue(
              fieldName='EstDays', fieldValue='4', approvalName='DesignReview',
              derived=False),
           api_pb2_v1.FieldValue(fieldName='StringField', fieldValue='string',
                                 phaseName="NotAPhase", derived=False),
           api_pb2_v1.FieldValue(fieldName='StringField',
                                 fieldValue=u'\xe2\x9d\xa4\xef\xb8\x8f',
                                 derived=False),
          ]
      )
      self.assertEqual(
          result.approvalValues,
          [api_pb2_v1.Approval(
            approvalName="DesignReview",
            approvers=[self.person_1],
            status=api_pb2_v1.ApprovalStatus.notSet,
            phaseName="JustAPhase",
          ),
           api_pb2_v1.Approval(
               approvalName="DressReview",
               approvers=[self.person_1],
               status=api_pb2_v1.ApprovalStatus.notSet,
           )]
      )
      self.assertEqual(
          result.phases,
          [api_pb2_v1.Phase(phaseName="JustAPhase", rank=4),
           api_pb2_v1.Phase(phaseName="NotAPhase", rank=9)
          ])
Exemplo n.º 22
0
    def createAndAssertUpdates(self,
                               project_ids=None,
                               user_ids=None,
                               ascending=True):
        user = user_pb2.MakeUser(self.user_id)
        comment_1 = tracker_pb2.IssueComment(id=self.comment_id,
                                             issue_id=self.issue_id,
                                             project_id=self.project_id,
                                             user_id=self.user_id,
                                             content='this is the 1st comment',
                                             timestamp=self.comment_timestamp)
        self.mox.StubOutWithMock(self.services.issue, 'GetComments')

        created_order = 'created'
        field = 'project_id' if project_ids else 'commenter_id'
        where_clauses = [('Issue.id = Comment.issue_id', [])]
        if project_ids:
            where_clauses.append(('Comment.project_id IN (%s)', project_ids))
        if user_ids:
            where_clauses.append(('Comment.commenter_id IN (%s)', user_ids))
        if ascending:
            where_clauses.append(('created > %s', [self.mr_after]))
        else:
            created_order += ' DESC'
        self.services.issue.GetComments(
            mox.IgnoreArg(),
            deleted_by=None,
            joins=[('Issue', [])],
            limit=activities.UPDATES_PER_PAGE + 1,
            order_by=[(created_order, [])],
            use_clause='USE INDEX (%s) USE INDEX FOR ORDER BY (%s)' %
            (field, field),
            where=where_clauses).AndReturn([comment_1])

        self.mox.StubOutWithMock(framework_views, 'MakeAllUserViews')
        framework_views.MakeAllUserViews(mox.IgnoreArg(), self.services.user,
                                         [self.user_id],
                                         []).AndReturn({self.user_id: user})

        self.mox.ReplayAll()

        mr = testing_helpers.MakeMonorailRequest()
        if ascending:
            mr.after = self.mr_after

        updates_page_url = 'testing/testing'
        updates_data = activities.GatherUpdatesData(
            self.services,
            mr,
            profiler.Profiler(),
            project_ids=project_ids,
            user_ids=user_ids,
            ending=None,
            autolink=None,
            highlight='highlightme',
            updates_page_url=updates_page_url)
        self.mox.VerifyAll()

        if mr.after:
            pagination = updates_data['pagination']
            self.assertIsNone(pagination.last)
            self.assertEquals(
                '%s?before=%d' %
                (updates_page_url.split('/')[-1], self.comment_timestamp),
                pagination.next_url)
            self.assertEquals(
                '%s?after=%d' %
                (updates_page_url.split('/')[-1], self.comment_timestamp),
                pagination.prev_url)

        activity_view = updates_data['updates_data'].older[0]
        self.assertEqual(
            '<a class="ot-issue-link"\n \n '
            'href="/p//issues/detail?id=%s#c_ts%s"\n >'
            'issue %s</a>\n\n()\n\n\n\n\n \n commented on' %
            (self.issue_local_id, self.comment_timestamp, self.issue_local_id),
            activity_view.escaped_title)
        self.assertEqual(
            '<span class="ot-issue-comment">\n this is the 1st comment\n</span>',
            activity_view.escaped_body)
        self.assertEqual('highlightme', activity_view.highlight)
        self.assertEqual(self.project_name, activity_view.project_name)
Exemplo n.º 23
0
 def testTopLevelPhase(self):
     prof = profiler.Profiler()
     self.assertEquals(prof.current_phase.name, 'overall profile')
     self.assertEquals(prof.current_phase.parent, None)
     self.assertEquals(prof.current_phase, prof.top_phase)
     self.assertEquals(prof.next_color, 0)