Merge branch 'main' into avm99963-monorail

Merged commit 34d8229ae2b51fb1a15bd208e6fe6185c94f6266

GitOrigin-RevId: 7ee0917f93a577e475f8e09526dd144d245593f4
diff --git a/features/test/hotlistissuescsv_test.py b/features/test/hotlistissuescsv_test.py
index afa53d5..f899ce8 100644
--- a/features/test/hotlistissuescsv_test.py
+++ b/features/test/hotlistissuescsv_test.py
@@ -1,18 +1,18 @@
-# Copyright 2016 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style
-# license that can be found in the LICENSE file or at
-# https://developers.google.com/open-source/licenses/bsd
+# Copyright 2016 The Chromium Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
 
 """Unit tests for issuelistcsv module."""
 from __future__ import print_function
 from __future__ import division
 from __future__ import absolute_import
 
+import six
 import unittest
 
 from google.appengine.ext import testbed
 
-import webapp2
+import flask
 
 from framework import permissions
 from framework import sorting
@@ -38,8 +38,8 @@
         project=fake.ProjectService(),
         cache_manager=fake.CacheManager(),
         features=fake.FeaturesService())
-    self.servlet = hotlistissuescsv.HotlistIssuesCsv(
-        'req', webapp2.Response(), services=self.services)
+    self.servlet = hotlistissuescsv.HotlistIssuesCsv(services=self.services)
+    self.servlet.response = flask.Response()
     self.user1 = self.services.user.TestAddUser('testuser@gmail.com', 111)
     self.user2 = self.services.user.TestAddUser('testuser2@gmail.com', 222)
     self.services.project.TestAddProject('project-name', project_id=1)
@@ -80,7 +80,7 @@
     for path in ('/u/222/hotlists/MyHotlist',
                  '/u/testuser2@gmail.com/hotlists/MyHotlist'):
       token = 'bad'
-      self._MakeMR(path + '?token=%s' % token)
+      self._MakeMR(path + '?token=%s' % six.ensure_str(token))
       self.mr.auth.user_id = self.user2.user_id
       self.assertRaises(xsrf.TokenIncorrect,
                         self.servlet.GatherPageData, self.mr)
@@ -91,7 +91,7 @@
                  '/u/testuser2@gmail.com/hotlists/MyHotlist'):
       form_token_path = self.servlet._FormHandlerURL(path)
       token = xsrf.GenerateToken(self.user1.user_id, form_token_path)
-      self._MakeMR(path + '?token=%s' % token)
+      self._MakeMR(path + '?token=%s' % six.ensure_str(token))
       self.mr.auth.email = self.user1.email
       self.mr.auth.user_id = self.user1.user_id
       self.servlet.GatherPageData(self.mr)