Exemplo n.º 1
0
  def test_console_utf8_devcomment(self):
    """Test that a console DevComment row with a UTF-8 character is retained."""
    for master in ['mac']:
      page_data = {'content': self.read_file('in_%s.html' % master)}
      app.parse_master(
          localpath='chromium.%s/console' % master,
          remoteurl='http://build.chromium.org/p/chromium.%s/console' % master,
          page_data=page_data)

    # Get the expected and real output, compare.
    app.console_merger(
        'chromium/console', '', {},
        masters_to_merge=[
            'chromium.mac',
        ],
        num_rows_to_merge=20)
    act_merged = app.get_and_cache_pagedata('chromium/console')['content']

    # Uncomment if deeper inspection is needed of the returned console.
    # import logging
    # logging.debug('foo')
    # self.write_file('exp_merged.html', act_merged.encode('utf-8'))
    # import code
    # code.interact(local=locals())

    self.assertEquals(self.read_file('exp_merged.html').decode('utf-8'),
                      act_merged, 'Unexpected console output found')
Exemplo n.º 2
0
 def cache_merged_console(self, localpath):
     # Remove any query args that we don't want to keep.
     VARY_ARGS = ['numrevs=']
     args = self.request.query_string.split('&')
     args = [
         arg for arg in args
         if any([arg.startswith(pre) for pre in VARY_ARGS])
     ]
     if args:
         localpath += '?' + '&'.join(args)
     # See if we already have the appropriate page cached.
     unquoted_localpath = urllib.unquote(localpath)
     page_data = app.get_and_cache_pagedata(unquoted_localpath)
     # If we got the page and it was generated recently enough, just serve that.
     if page_data.get('content') and recent_page(page_data):
         return page_data
     # If they specified a number of revs, figure out how many they want.
     num_revs = self.request.get('numrevs')
     if num_revs:
         num_revs = utils.clean_int(num_revs, -1)
         if num_revs <= 0:
             num_revs = None
     app.console_merger(unquoted_localpath,
                        'console/chromium',
                        page_data,
                        num_rows_to_merge=num_revs)
     return app.get_and_cache_pagedata(unquoted_localpath)
Exemplo n.º 3
0
    def test_console_utf8_devcomment(self):
        """Test that a console DevComment row with a UTF-8 character is retained."""
        for master in ['mac']:
            page_data = {'content': self.read_file('in_%s.html' % master)}
            app.parse_master(
                localpath='chromium.%s/console' % master,
                remoteurl='http://build.chromium.org/p/chromium.%s/console' %
                master,
                page_data=page_data)

        # Get the expected and real output, compare.
        app.console_merger('chromium/console',
                           '', {},
                           masters_to_merge=[
                               'chromium.mac',
                           ],
                           num_rows_to_merge=20)
        act_merged = app.get_and_cache_pagedata('chromium/console')['content']

        # Uncomment if deeper inspection is needed of the returned console.
        # import logging
        # logging.debug('foo')
        # self.write_file('exp_merged.html', act_merged.encode('utf-8'))
        # import code
        # code.interact(local=locals())

        self.assertEquals(
            self.read_file('exp_merged.html').decode('utf-8'), act_merged,
            'Unexpected console output found')
Exemplo n.º 4
0
 def cache_merged_console(self, localpath):
   # Remove any query args that we don't want to keep.
   VARY_ARGS = ['numrevs=']
   args = self.request.query_string.split('&')
   args = [arg for arg in args if any([arg.startswith(pre) for pre in
                                       VARY_ARGS])]
   if args:
     localpath += '?' + '&'.join(args)
   # See if we already have the appropriate page cached.
   unquoted_localpath = urllib.unquote(localpath)
   page_data = app.get_and_cache_pagedata(unquoted_localpath)
   # If we got the page and it was generated recently enough, just serve that.
   if page_data.get('content') and recent_page(page_data):
     return page_data
   # If they specified a number of revs, figure out how many they want.
   num_revs = self.request.get('numrevs')
   if num_revs:
     num_revs = utils.clean_int(num_revs, -1)
     if num_revs <= 0:
       num_revs = None
   app.console_merger(unquoted_localpath, 'console/chromium', page_data,
                      num_rows_to_merge=num_revs)
   return app.get_and_cache_pagedata(unquoted_localpath)