Merge branch 'main' into avm99963-monorail

Merged commit 34d8229ae2b51fb1a15bd208e6fe6185c94f6266

GitOrigin-RevId: 7ee0917f93a577e475f8e09526dd144d245593f4
diff --git a/tracker/test/attachment_helpers_test.py b/tracker/test/attachment_helpers_test.py
index 18e0efc..cbc7458 100644
--- a/tracker/test/attachment_helpers_test.py
+++ b/tracker/test/attachment_helpers_test.py
@@ -1,7 +1,6 @@
-# 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.
 
 """Unittest for the tracker helpers module."""
 from __future__ import print_function
@@ -11,7 +10,7 @@
 from mock import Mock, patch
 import unittest
 
-from proto import tracker_pb2
+from mrproto import tracker_pb2
 from tracker import attachment_helpers
 
 
@@ -146,4 +145,3 @@
     # Anything that is not a video.
     attach.mimetype = 'audio/mp3'
     self.assertIsNone(attachment_helpers.GetVideoURL(attach, download_url))
-
diff --git a/tracker/test/component_helpers_test.py b/tracker/test/component_helpers_test.py
index ee7f56c..3603583 100644
--- a/tracker/test/component_helpers_test.py
+++ b/tracker/test/component_helpers_test.py
@@ -1,7 +1,6 @@
-# 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 the component_helpers module."""
 from __future__ import print_function
@@ -10,7 +9,7 @@
 
 import unittest
 
-from proto import tracker_pb2
+from mrproto import tracker_pb2
 from services import service_manager
 from testing import fake
 from tracker import component_helpers
diff --git a/tracker/test/componentcreate_test.py b/tracker/test/componentcreate_test.py
index 1325d9b..2a14874 100644
--- a/tracker/test/componentcreate_test.py
+++ b/tracker/test/componentcreate_test.py
@@ -1,7 +1,6 @@
-# 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 the componentcreate servlet."""
 from __future__ import print_function
@@ -17,8 +16,6 @@
 from tracker import componentcreate
 from tracker import tracker_bizobj
 
-import webapp2
-
 
 class ComponentCreateTest(unittest.TestCase):
 
@@ -27,8 +24,7 @@
         user=fake.UserService(),
         config=fake.ConfigService(),
         project=fake.ProjectService())
-    self.servlet = componentcreate.ComponentCreate(
-        'req', 'res', services=self.services)
+    self.servlet = componentcreate.ComponentCreate(services=self.services)
     self.project = self.services.project.TestAddProject('proj')
     self.mr = testing_helpers.MakeMonorailRequest(
         project=self.project, perms=permissions.OWNER_ACTIVE_PERMISSIONSET)
@@ -87,8 +83,7 @@
         cc=[''],
         labels=[''])
     self.assertRaises(
-        webapp2.HTTPException,
-        self.servlet.ProcessFormData, self.mr, post_data)
+        Exception, self.servlet.ProcessFormData, self.mr, post_data)
 
   def testProcessFormData_Normal(self):
     post_data = fake.PostData(
diff --git a/tracker/test/componentdetail_test.py b/tracker/test/componentdetail_test.py
index 6186582..0dcff92 100644
--- a/tracker/test/componentdetail_test.py
+++ b/tracker/test/componentdetail_test.py
@@ -1,7 +1,6 @@
-# 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 the componentdetail servlet."""
 from __future__ import print_function
@@ -10,7 +9,7 @@
 
 import unittest
 
-from mock import Mock, patch
+from mock import Mock
 
 try:
   from mox3 import mox
@@ -19,7 +18,7 @@
 
 from features import filterrules_helpers
 from framework import permissions
-from proto import project_pb2
+from mrproto import project_pb2
 from services import service_manager
 from services import template_svc
 from testing import fake
@@ -27,8 +26,6 @@
 from tracker import componentdetail
 from tracker import tracker_bizobj
 
-import webapp2
-
 
 class ComponentDetailTest(unittest.TestCase):
 
@@ -39,8 +36,7 @@
         config=fake.ConfigService(),
         template=Mock(spec=template_svc.TemplateService),
         project=fake.ProjectService())
-    self.servlet = componentdetail.ComponentDetail(
-        'req', 'res', services=self.services)
+    self.servlet = componentdetail.ComponentDetail(services=self.services)
     self.project = self.services.project.TestAddProject('proj')
     self.mr = testing_helpers.MakeMonorailRequest(
         project=self.project, perms=permissions.OWNER_ACTIVE_PERMISSIONSET)
@@ -65,9 +61,7 @@
 
   def testGetComponentDef_NotFound(self):
     self.mr.component_path = 'NeverHeardOfIt'
-    self.assertRaises(
-        webapp2.HTTPException,
-        self.servlet._GetComponentDef, self.mr)
+    self.assertRaises(Exception, self.servlet._GetComponentDef, self.mr)
 
   def testGetComponentDef_Normal(self):
     actual_config, actual_cd = self.servlet._GetComponentDef(self.mr)
@@ -215,7 +209,7 @@
       self.servlet.ProcessFormData(self.mr, post_data)
     self.assertEqual(
         'User tried to delete component that had subcomponents',
-        cm.exception.message)
+        str(cm.exception))
 
   def testProcessFormData_Edit(self):
     post_data = fake.PostData(
diff --git a/tracker/test/field_helpers_test.py b/tracker/test/field_helpers_test.py
index f49a147..5d46586 100644
--- a/tracker/test/field_helpers_test.py
+++ b/tracker/test/field_helpers_test.py
@@ -1,7 +1,6 @@
-# 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 the field_helpers module."""
 from __future__ import print_function
@@ -15,8 +14,8 @@
 from framework import exceptions
 from framework import permissions
 from framework import template_helpers
-from proto import project_pb2
-from proto import tracker_pb2
+from mrproto import project_pb2
+from mrproto import tracker_pb2
 from services import service_manager
 from services import config_svc
 from testing import fake
@@ -1274,3 +1273,43 @@
     self.assertEqual(
         self.mr.errors.min_value, 'Minimum value must be less than maximum.')
     self.assertEqual(self.mr.errors.regex, 'Invalid regular expression.')
+
+  def testValidateLabels_NoLabels(self):
+    err_msg = field_helpers.ValidateLabels(
+        self.mr.cnxn,
+        self.services,
+        self.mr.project_id, [''],
+        ezt_errors=self.errors)
+    self.assertFalse(self.errors.AnyErrors())
+    self.assertEqual(err_msg, None)
+
+  def testValidateLabels_ExistingLabel(self):
+    err_msg = field_helpers.ValidateLabels(
+        self.mr.cnxn,
+        self.services,
+        self.mr.project_id, ['old_label'],
+        ezt_errors=self.errors)
+    self.assertFalse(self.errors.AnyErrors())
+    self.assertEqual(err_msg, None)
+
+  def testValidateLabels_AllowlistedLabel(self):
+    err_msg = field_helpers.ValidateLabels(
+        self.mr.cnxn,
+        self.services,
+        self.mr.project_id, ['old_label', 'CVE-test'],
+        ezt_errors=self.errors)
+    self.assertFalse(self.errors.AnyErrors())
+    self.assertEqual(err_msg, None)
+
+  def testValidateLabels_Error(self):
+    err_msg = field_helpers.ValidateLabels(
+        self.mr.cnxn,
+        self.services,
+        self.mr.project_id, ['freeze_new_label'],
+        ezt_errors=self.errors)
+    self.assertTrue(self.errors.AnyErrors())
+    self.assertEqual(
+        err_msg, (
+            'The creation of new labels is blocked for the Chromium project'
+            ' in Monorail. To continue with editing your issue, please'
+            ' remove: freeze_new_label label(s).'))
diff --git a/tracker/test/fieldcreate_test.py b/tracker/test/fieldcreate_test.py
index 4a8c919..c1b9729 100644
--- a/tracker/test/fieldcreate_test.py
+++ b/tracker/test/fieldcreate_test.py
@@ -1,7 +1,6 @@
-# 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 the fieldcreate servlet."""
 from __future__ import print_function
@@ -13,13 +12,14 @@
 except ImportError:
   import mox
 import mock
+import six
 import unittest
 import logging
 
 import ezt
 
 from framework import permissions
-from proto import tracker_pb2
+from mrproto import tracker_pb2
 from services import service_manager
 from testing import fake
 from testing import testing_helpers
@@ -35,8 +35,7 @@
         user=fake.UserService(),
         config=fake.ConfigService(),
         project=fake.ProjectService())
-    self.servlet = fieldcreate.FieldCreate(
-        'req', 'res', services=self.services)
+    self.servlet = fieldcreate.FieldCreate(services=self.services)
     self.project = self.services.project.TestAddProject('proj')
     self.mr = testing_helpers.MakeMonorailRequest(
         project=self.project, perms=permissions.OWNER_ACTIVE_PERMISSIONSET)
@@ -84,8 +83,8 @@
     page_data = self.servlet.GatherPageData(self.mr)
     self.assertEqual(self.servlet.PROCESS_TAB_LABELS,
                      page_data['admin_tab_mode'])
-    self.assertItemsEqual(
-        ['Defect', 'Enhancement', 'Task', 'Other'],
+    six.assertCountEqual(
+        self, ['Defect', 'Enhancement', 'Task', 'Other'],
         page_data['well_known_issue_types'])
     self.assertEqual(['LaunchApproval'], page_data['approval_names'])
     self.assertEqual('', page_data['initial_admins'])
diff --git a/tracker/test/fielddetail_test.py b/tracker/test/fielddetail_test.py
index 5b31fa3..ecd096b 100644
--- a/tracker/test/fielddetail_test.py
+++ b/tracker/test/fielddetail_test.py
@@ -1,7 +1,6 @@
-# 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 the fielddetail servlet."""
 from __future__ import print_function
@@ -15,19 +14,14 @@
 import unittest
 import logging
 
-import webapp2
-
-import ezt
-
 from framework import permissions
-from proto import project_pb2
-from proto import tracker_pb2
+from mrproto import project_pb2
+from mrproto import tracker_pb2
 from services import service_manager
 from testing import fake
 from testing import testing_helpers
 from tracker import fielddetail
 from tracker import tracker_bizobj
-from tracker import tracker_views
 
 
 class FieldDetailTest(unittest.TestCase):
@@ -37,8 +31,7 @@
         user=fake.UserService(),
         config=fake.ConfigService(),
         project=fake.ProjectService())
-    self.servlet = fielddetail.FieldDetail(
-        'req', 'res', services=self.services)
+    self.servlet = fielddetail.FieldDetail(services=self.services)
     self.project = self.services.project.TestAddProject('proj')
     self.mr = testing_helpers.MakeMonorailRequest(
         project=self.project, perms=permissions.OWNER_ACTIVE_PERMISSIONSET)
@@ -80,9 +73,7 @@
 
   def testGetFieldDef_NotFound(self):
     self.mr.field_name = 'NeverHeardOfIt'
-    self.assertRaises(
-        webapp2.HTTPException,
-        self.servlet._GetFieldDef, self.mr)
+    self.assertRaises(Exception, self.servlet._GetFieldDef, self.mr)
 
   def testGetFieldDef_Normal(self):
     actual_config, actual_fd = self.servlet._GetFieldDef(self.mr)
diff --git a/tracker/test/fltconversion_test.py b/tracker/test/fltconversion_test.py
index be66ad2..2526fdc 100644
--- a/tracker/test/fltconversion_test.py
+++ b/tracker/test/fltconversion_test.py
@@ -1,7 +1,6 @@
-# Copyright 2018 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 2018 The Chromium Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
 
 """Unittests for the flt launch issues conversion task."""
 from __future__ import print_function
@@ -21,7 +20,7 @@
 from tracker import tracker_bizobj
 from testing import fake
 from testing import testing_helpers
-from proto import tracker_pb2
+from mrproto import tracker_pb2
 
 class FLTConvertTask(unittest.TestCase):
 
@@ -411,13 +410,13 @@
   def testFetchAndAssertProjectInfo(self):
 
     # test no 'launch' in request
-    self.assertRaisesRegexp(
+    self.assertRaisesRegex(
         AssertionError, r'bad launch type:',
         self.task.FetchAndAssertProjectInfo, self.mr)
 
     # test bad 'launch' in request
     mr = testing_helpers.MakeMonorailRequest(path='url/url?launch=bad')
-    self.assertRaisesRegexp(
+    self.assertRaisesRegex(
         AssertionError, r'bad launch type: bad',
         self.task.FetchAndAssertProjectInfo, mr)
 
@@ -429,7 +428,7 @@
     # test no template
     self.task.services.template.GetTemplateByName = mock.Mock(
         return_value=None)
-    self.assertRaisesRegexp(
+    self.assertRaisesRegex(
         AssertionError, r'not found in chromium project',
         self.task.FetchAndAssertProjectInfo, mr)
 
@@ -438,14 +437,14 @@
         'template', 'sum', 'New', 111, 'content', [], [], [], [])
     self.task.services.template.GetTemplateByName = mock.Mock(
         return_value=template)
-    self.assertRaisesRegexp(
+    self.assertRaisesRegex(
         AssertionError, 'no approvals or phases in',
         self.task.FetchAndAssertProjectInfo, mr)
 
     # test phases not recognized
     template.phases = [tracker_pb2.Phase(name='WeirdPhase')]
     template.approval_values = [tracker_pb2.ApprovalValue()]
-    self.assertRaisesRegexp(
+    self.assertRaisesRegex(
         AssertionError, 'one or more phases not recognized',
         self.task.FetchAndAssertProjectInfo, mr)
 
@@ -457,7 +456,7 @@
         tracker_pb2.ApprovalValue(approval_id=3)]
 
     # test approvals not recognized
-    self.assertRaisesRegexp(
+    self.assertRaisesRegex(
         AssertionError, 'one or more approvals not recognized',
         self.task.FetchAndAssertProjectInfo, mr)
 
@@ -471,7 +470,7 @@
     ]
 
     # test approvals not in config's approval_defs
-    self.assertRaisesRegexp(
+    self.assertRaisesRegex(
         AssertionError, 'one or more approvals not in config.approval_defs',
         self.task.FetchAndAssertProjectInfo, mr)
 
@@ -481,7 +480,7 @@
         tracker_pb2.ApprovalDef(approval_id=3)]
 
     # test no pm field exists in project
-    self.assertRaisesRegexp(
+    self.assertRaisesRegex(
         AssertionError, 'project has no FieldDef %s' % fltconversion.PM_FIELD,
         self.task.FetchAndAssertProjectInfo, mr)
 
@@ -496,7 +495,7 @@
     ])
 
     # test no USER_TYPE te field exists in project
-    self.assertRaisesRegexp(
+    self.assertRaisesRegex(
         AssertionError, 'project has no FieldDef %s' % fltconversion.TE_FIELD,
         self.task.FetchAndAssertProjectInfo, mr)
 
@@ -510,7 +509,7 @@
         ])
 
     # test no M-Target INT_TYPE multivalued Phase FieldDefs
-    self.assertRaisesRegexp(
+    self.assertRaisesRegex(
         AssertionError,
         'project has no FieldDef %s' % fltconversion.MTARGET_FIELD,
         self.task.FetchAndAssertProjectInfo, mr)
@@ -519,7 +518,7 @@
     self.config.field_defs[-2].is_multivalued = True
 
     # test no M-Approved INT_TYPE multivalued Phase FieldDefs
-    self.assertRaisesRegexp(
+    self.assertRaisesRegex(
         AssertionError,
         'project has no FieldDef %s' % fltconversion.MAPPROVED_FIELD,
         self.task.FetchAndAssertProjectInfo, mr)
@@ -538,7 +537,7 @@
     # FINCH special case
     # test approvals for Finch not required
     mr = testing_helpers.MakeMonorailRequest(path='url/url?launch=finch')
-    self.assertRaisesRegexp(
+    self.assertRaisesRegex(
         AssertionError, 'finch template not set up correctly',
         self.task.FetchAndAssertProjectInfo, mr)
 
@@ -568,7 +567,7 @@
     # test phases not recognized
     template.phases = [tracker_pb2.Phase(name='Chrome-Test')]
     template.approval_values = [tracker_pb2.ApprovalValue()]
-    self.assertRaisesRegexp(
+    self.assertRaisesRegex(
         AssertionError, 'one or more phases not recognized',
         self.task.FetchAndAssertProjectInfo, mr)
 
@@ -580,7 +579,7 @@
         tracker_pb2.ApprovalValue(approval_id=1),
         tracker_pb2.ApprovalValue(approval_id=2),
         tracker_pb2.ApprovalValue(approval_id=3)]
-    self.assertRaisesRegexp(
+    self.assertRaisesRegex(
         AssertionError, 'os template not set up correctly',
         self.task.FetchAndAssertProjectInfo, mr)
 
@@ -588,7 +587,7 @@
       av.status = tracker_pb2.ApprovalStatus.NEEDS_REVIEW
 
     # test approvals not recognized
-    self.assertRaisesRegexp(
+    self.assertRaisesRegex(
         AssertionError, 'one or more approvals not recognized',
         self.task.FetchAndAssertProjectInfo, mr)
 
diff --git a/tracker/test/issueadmin_test.py b/tracker/test/issueadmin_test.py
index c36a495..c19a21d 100644
--- a/tracker/test/issueadmin_test.py
+++ b/tracker/test/issueadmin_test.py
@@ -1,7 +1,6 @@
-# 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.
 
 """Tests for the issue admin pages."""
 from __future__ import print_function
@@ -12,13 +11,15 @@
   from mox3 import mox
 except ImportError:
   import mox
+import six
 import unittest
 
+import settings
 from mock import Mock, patch
 
 from framework import permissions
 from framework import urls
-from proto import tracker_pb2
+from mrproto import tracker_pb2
 from services import service_manager
 from services import template_svc
 from testing import fake
@@ -39,7 +40,7 @@
         issue=fake.IssueService(),
         template=Mock(spec=template_svc.TemplateService),
         features=fake.FeaturesService())
-    self.servlet = servlet_factory('req', 'res', services=self.services)
+    self.servlet = servlet_factory(services=self.services)
     self.project = self.services.project.TestAddProject(
         'proj', project_id=789, contrib_ids=[333])
     self.config = tracker_bizobj.MakeDefaultProjectIssueConfig(789)
@@ -47,6 +48,8 @@
     self.cnxn = fake.MonorailConnection()
     self.mr = testing_helpers.MakeMonorailRequest(
         path='/p/proj/admin', project=self.project)
+    # Default to admin perms given that most tests assume the user can edit.
+    self.mr.perms = permissions.ADMIN_PERMISSIONSET
     self.mox = mox.Mox()
     self.test_template = tracker_bizobj.MakeIssueTemplate(
         'Test Template', 'sum', 'New', 111, 'content', [], [], [], [])
@@ -58,6 +61,8 @@
     self.services.template.GetTemplateSetForProject\
         .return_value = [(12345, 'Test template', 0)]
 
+    settings.config_freeze_project_ids = {}
+
   def tearDown(self):
     self.mox.UnsetStubs()
     self.mox.ResetAll()
@@ -80,9 +85,11 @@
     page_data = self.servlet.GatherPageData(self.mr)
     self.mox.VerifyAll()
 
-    self.assertItemsEqual(
-        ['admin_tab_mode', 'config', 'open_text', 'closed_text', 'labels_text'],
-        list(page_data.keys()))
+    six.assertCountEqual(
+        self, [
+            'admin_tab_mode', 'config', 'open_text', 'closed_text',
+            'labels_text', 'can_edit_project'
+        ], list(page_data.keys()))
     config_view = page_data['config']
     self.assertEqual(789, config_view.project_id)
 
@@ -91,6 +98,7 @@
 
   def setUp(self):
     super(AdminStatusesTest, self).setUpServlet(issueadmin.AdminStatuses)
+    self.servlet.mr = self.mr
 
   @patch('framework.servlet.Servlet.PleaseCorrect')
   def testProcessSubtabForm_MissingInput(self, mock_pc):
@@ -143,10 +151,11 @@
     page_data = self.servlet.GatherPageData(self.mr)
     self.mox.VerifyAll()
 
-    self.assertItemsEqual(
-        ['admin_tab_mode', 'config', 'field_defs',
-         'open_text', 'closed_text', 'labels_text'],
-        list(page_data.keys()))
+    six.assertCountEqual(
+        self, [
+            'admin_tab_mode', 'config', 'field_defs', 'open_text',
+            'closed_text', 'labels_text', 'can_edit_project'
+        ], list(page_data.keys()))
     config_view = page_data['config']
     self.assertEqual(789, config_view.project_id)
     self.assertEqual([], page_data['field_defs'])
@@ -300,11 +309,12 @@
     self.mox.ReplayAll()
     page_data = self.servlet.GatherPageData(self.mr)
     self.mox.VerifyAll()
-    self.assertItemsEqual(
-        ['admin_tab_mode', 'failed_templ', 'component_defs', 'failed_perm',
-         'config', 'failed_subcomp',
-         'open_text', 'closed_text', 'labels_text'],
-        list(page_data.keys()))
+    six.assertCountEqual(
+        self, [
+            'admin_tab_mode', 'failed_templ', 'component_defs', 'failed_perm',
+            'config', 'failed_subcomp', 'open_text', 'closed_text',
+            'labels_text', 'can_edit_project'
+        ], list(page_data.keys()))
     config_view = page_data['config']
     self.assertEqual(789, config_view.project_id)
     self.assertEqual([], page_data['component_defs'])
@@ -367,11 +377,12 @@
     page_data = self.servlet.GatherPageData(self.mr)
     self.mox.VerifyAll()
 
-    self.assertItemsEqual(
-        ['canned_queries', 'admin_tab_mode', 'config', 'issue_notify',
-         'new_query_indexes', 'max_queries',
-         'open_text', 'closed_text', 'labels_text'],
-        list(page_data.keys()))
+    six.assertCountEqual(
+        self, [
+            'canned_queries', 'admin_tab_mode', 'config', 'issue_notify',
+            'new_query_indexes', 'max_queries', 'open_text', 'closed_text',
+            'labels_text', 'can_edit_project'
+        ], list(page_data.keys()))
     config_view = page_data['config']
     self.assertEqual(789, config_view.project_id)
 
@@ -424,8 +435,9 @@
     self.assertEqual('label1-sub1', y_attr)
 
     # Test that multibyte strings are not mangled.
-    spec = ('\xe7\xaa\xbf\xe8\x8b\xa5-\xe7\xb9\xb9 '
-            '\xe5\x9c\xb0\xe3\x81\xa6-\xe5\xbd\x93-\xe3\x81\xbe\xe3\x81\x99')
+    spec = (
+        b'\xe7\xaa\xbf\xe8\x8b\xa5-\xe7\xb9\xb9 '
+        b'\xe5\x9c\xb0\xe3\x81\xa6-\xe5\xbd\x93-\xe3\x81\xbe\xe3\x81\x99')
     spec = spec.decode('utf-8')
     (col_spec, sort_spec, x_attr, y_attr, member_default_query,
      ) = issueadmin._ParseListPreferences(
@@ -437,10 +449,10 @@
         )
     self.assertEqual(spec, col_spec)
     self.assertEqual(' '.join(spec.split()), sort_spec)
-    self.assertEqual('\xe7\xaa\xbf\xe8\x8b\xa5-\xe7\xb9\xb9'.decode('utf-8'),
-                     x_attr)
-    self.assertEqual('\xe7\xaa\xbf\xe8\x8b\xa5-\xe7\xb9\xb9'.decode('utf-8'),
-                     y_attr)
+    self.assertEqual(
+        b'\xe7\xaa\xbf\xe8\x8b\xa5-\xe7\xb9\xb9'.decode('utf-8'), x_attr)
+    self.assertEqual(
+        b'\xe7\xaa\xbf\xe8\x8b\xa5-\xe7\xb9\xb9'.decode('utf-8'), y_attr)
     self.assertEqual(spec, member_default_query)
 
 
@@ -455,10 +467,12 @@
     page_data = self.servlet.GatherPageData(self.mr)
     self.mox.VerifyAll()
 
-    self.assertItemsEqual(
-        ['admin_tab_mode', 'config', 'rules', 'new_rule_indexes',
-         'max_rules', 'open_text', 'closed_text', 'labels_text'],
-        list(page_data.keys()))
+    six.assertCountEqual(
+        self, [
+            'admin_tab_mode', 'config', 'rules', 'new_rule_indexes',
+            'max_rules', 'open_text', 'closed_text', 'labels_text',
+            'can_edit_project'
+        ], list(page_data.keys()))
     config_view = page_data['config']
     self.assertEqual(789, config_view.project_id)
     self.assertEqual([], page_data['rules'])
diff --git a/tracker/test/issueadvsearch_test.py b/tracker/test/issueadvsearch_test.py
index fd1ee2e..a84e4e1 100644
--- a/tracker/test/issueadvsearch_test.py
+++ b/tracker/test/issueadvsearch_test.py
@@ -1,7 +1,6 @@
-# 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.
 
 """Tests for monorail.tracker.issueadvsearch."""
 from __future__ import print_function
@@ -25,8 +24,7 @@
         user=fake.UserService(),
         project=fake.ProjectService())
     self.project = self.services.project.TestAddProject('proj', project_id=987)
-    self.servlet = issueadvsearch.IssueAdvancedSearch(
-        'req', 'res', services=self.services)
+    self.servlet = issueadvsearch.IssueAdvancedSearch(services=self.services)
 
   def testGatherData(self):
     mr = testing_helpers.MakeMonorailRequest(
diff --git a/tracker/test/issueattachment_test.py b/tracker/test/issueattachment_test.py
index f782f22..0330e19 100644
--- a/tracker/test/issueattachment_test.py
+++ b/tracker/test/issueattachment_test.py
@@ -1,7 +1,6 @@
-# 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.
 
 """Tests for monorail.tracker.issueattachment."""
 from __future__ import print_function
@@ -16,11 +15,10 @@
   from mox3 import mox
 except ImportError:
   import mox
-import webapp2
 
-from framework import gcs_helpers
+from framework import exceptions, gcs_helpers
 from framework import permissions
-from proto import tracker_pb2
+from mrproto import tracker_pb2
 from services import service_manager
 from testing import fake
 from testing import testing_helpers
@@ -45,8 +43,7 @@
         issue=fake.IssueService(),
         user=fake.UserService())
     self.project = services.project.TestAddProject('proj')
-    self.servlet = issueattachment.AttachmentPage(
-        'req', webapp2.Response(), services=services)
+    self.servlet = issueattachment.AttachmentPage(services=services)
     services.user.TestAddUser('commenter@example.com', 111)
     self.issue = fake.MakeTestIssue(
         self.project.project_id, 1, 'summary', 'New', 111)
@@ -79,7 +76,7 @@
     _request, mr = testing_helpers.GetRequestObjects(
         project=self.project, path=path,
         perms=permissions.EMPTY_PERMISSIONSET)
-    with self.assertRaises(webapp2.HTTPException) as cm:
+    with self.assertRaises(Exception) as cm:
       self.servlet.GatherPageData(mr)
     self.assertEqual(404, cm.exception.code)
 
@@ -125,18 +122,17 @@
         'app_default_bucket',
         '/pid/attachments/object_id-download'
         ).AndReturn('googleusercontent.com/...-download...')
-    self.mox.StubOutWithMock(self.servlet, 'redirect')
     path = '/p/proj/issues/attachment?aid=%s&signed_aid=signed_%d' % (
         aid, aid)
     _request, mr = testing_helpers.GetRequestObjects(
         project=self.project, path=path,
         perms=permissions.READ_ONLY_PERMISSIONSET)  # includes VIEW
-    self.servlet.redirect(
-      mox.And(mox.StrContains('googleusercontent.com'),
-              mox.StrContains('-download')), abort=True)
     self.mox.ReplayAll()
-    self.servlet.GatherPageData(mr)
+    with self.assertRaises(exceptions.RedirectException) as e:
+      self.servlet.GatherPageData(mr)
     self.mox.VerifyAll()
+    self.assertIn('googleusercontent.com', str(e.exception))
+    self.assertIn('-download', str(e.exception))
 
   def testGatherPageData_Download_WithoutDisposition(self):
     aid = self.attachment.attachment_id
@@ -152,16 +148,15 @@
         'app_default_bucket',
         '/pid/attachments/object_id'
         ).AndReturn('googleusercontent.com/...')
-    self.mox.StubOutWithMock(self.servlet, 'redirect')
     _request, mr = testing_helpers.GetRequestObjects(
         project=self.project, path=path,
         perms=permissions.READ_ONLY_PERMISSIONSET)  # includes VIEW
-    self.servlet.redirect(
-      mox.And(mox.StrContains('googleusercontent.com'),
-              mox.Not(mox.StrContains('-download'))), abort=True)
     self.mox.ReplayAll()
-    self.servlet.GatherPageData(mr)
+    with self.assertRaises(exceptions.RedirectException) as e:
+      self.servlet.GatherPageData(mr)
     self.mox.VerifyAll()
+    self.assertIn('googleusercontent.com', str(e.exception))
+    self.assertNotIn('-download', str(e.exception))
 
   def testGatherPageData_DownloadBadFilename(self):
     aid = self.attachment.attachment_id
@@ -179,14 +174,12 @@
         'app_default_bucket',
         '/pid/attachments/object_id-download'
         ).AndReturn('googleusercontent.com/...-download...')
-    self.mox.StubOutWithMock(self.servlet, 'redirect')
     _request, mr = testing_helpers.GetRequestObjects(
         project=self.project,
         path=path,
         perms=permissions.READ_ONLY_PERMISSIONSET)  # includes VIEW
-    self.servlet.redirect(mox.And(
-        mox.Not(mox.StrContains(self.attachment.filename)),
-        mox.StrContains('googleusercontent.com')), abort=True)
     self.mox.ReplayAll()
-    self.servlet.GatherPageData(mr)
+    with self.assertRaises(exceptions.RedirectException) as e:
+      self.servlet.GatherPageData(mr)
     self.mox.VerifyAll()
+    self.assertIn('googleusercontent.com', str(e.exception))
diff --git a/tracker/test/issueattachmenttext_test.py b/tracker/test/issueattachmenttext_test.py
index f7dda8d..f6a2447 100644
--- a/tracker/test/issueattachmenttext_test.py
+++ b/tracker/test/issueattachmenttext_test.py
@@ -1,7 +1,6 @@
-# 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.
 
 """Tests for issueattachmenttext."""
 from __future__ import print_function
@@ -15,10 +14,8 @@
 from google.appengine.ext import testbed
 from google.cloud import storage
 
-import webapp2
-
 from framework import permissions
-from proto import tracker_pb2
+from mrproto import tracker_pb2
 from services import service_manager
 from testing import fake
 from testing import testing_helpers
@@ -38,8 +35,7 @@
         issue=fake.IssueService(),
         user=fake.UserService())
     self.project = services.project.TestAddProject('proj')
-    self.servlet = issueattachmenttext.AttachmentText(
-        'req', 'res', services=services)
+    self.servlet = issueattachmenttext.AttachmentText(services=services)
 
     services.user.TestAddUser('commenter@example.com', 111)
 
@@ -88,7 +84,7 @@
     self.blob = mock.MagicMock()
     self.client.get_bucket = mock.MagicMock(return_value=self.bucket)
     self.bucket.get_blob = mock.MagicMock(return_value=self.blob)
-    self.blob.download_as_bytes = mock.MagicMock()
+    self.blob.download_as_bytes = mock.MagicMock(return_value=b'')
     mock.patch.object(storage, 'Client', return_value=self.client).start()
 
   def tearDown(self):
@@ -142,7 +138,7 @@
         project=self.project,
         path='/p/proj/issues/attachmentText?aid=9999',
         perms=permissions.READ_ONLY_PERMISSIONSET)
-    with self.assertRaises(webapp2.HTTPException) as cm:
+    with self.assertRaises(Exception) as cm:
       self.servlet.GatherPageData(mr)
     self.assertEqual(404, cm.exception.code)
 
@@ -153,13 +149,13 @@
         path='/p/proj/issues/attachmentText?aid=1234',
         perms=permissions.READ_ONLY_PERMISSIONSET)
     self.attach1.deleted = True
-    with self.assertRaises(webapp2.HTTPException) as cm:
+    with self.assertRaises(Exception) as cm:
       self.servlet.GatherPageData(mr)
-    self.assertEqual(404, cm.exception.code)
+      self.assertEqual(404, cm.exception.code)
 
   def testGatherPageData_Normal(self):
     self.blob.download_as_bytes = mock.MagicMock(
-        return_value='/app_default_bucket/pid/attachments/abcdefg')
+        return_value=b'/app_default_bucket/pid/attachments/abcdefg')
 
     _request, mr = testing_helpers.GetRequestObjects(
         project=self.project,
@@ -176,8 +172,8 @@
     file_lines = page_data['file_lines']
     self.assertEqual(1, len(file_lines))
     self.assertEqual(1, file_lines[0].num)
-    self.assertEqual('/app_default_bucket/pid/attachments/abcdefg',
-                     file_lines[0].line)
+    self.assertEqual(
+        '/app_default_bucket/pid/attachments/abcdefg', file_lines[0].line)
 
     self.assertEqual(None, page_data['code_reviews'])
 
diff --git a/tracker/test/issuebulkedit_test.py b/tracker/test/issuebulkedit_test.py
index 89d9bc3..c7bd1ca 100644
--- a/tracker/test/issuebulkedit_test.py
+++ b/tracker/test/issuebulkedit_test.py
@@ -1,7 +1,6 @@
-# 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.
 
 """Unittests for monorail.tracker.issuebulkedit."""
 from __future__ import print_function
@@ -11,14 +10,15 @@
 import mock
 import os
 import unittest
-import webapp2
+import flask
 
 from google.appengine.api import memcache
 from google.appengine.ext import testbed
 
 from framework import exceptions
 from framework import permissions
-from proto import tracker_pb2
+from mrproto import project_pb2
+from mrproto import tracker_pb2
 from services import service_manager
 from services import tracker_fulltext
 from testing import fake
@@ -45,8 +45,7 @@
         issue_star=fake.IssueStarService(),
         user=fake.UserService(),
         usergroup=fake.UserGroupService())
-    self.servlet = issuebulkedit.IssueBulkEdit(
-        'req', 'res', services=self.services)
+    self.servlet = issuebulkedit.IssueBulkEdit(services=self.services)
     self.mr = testing_helpers.MakeMonorailRequest(
         perms=permissions.OWNER_ACTIVE_PERMISSIONSET)
     self.project = self.services.project.TestAddProject(
@@ -177,8 +176,7 @@
         project=self.project)
     mr.local_id_list = [local_id_1]
 
-    self.assertRaises(webapp2.HTTPException,
-                      self.servlet.GatherPageData, mr)
+    self.assertRaises(Exception, self.servlet.GatherPageData, mr)
 
   def testGatherPageData_TypeLabels(self):
     """Test that GPD displays a custom field for appropriate issues."""
@@ -226,6 +224,38 @@
     url = self.servlet.ProcessFormData(mr, post_data)
     self.assertTrue('list?can=1&q=&saved=1' in url)
 
+  def testProcessFormData_FreezeLabels(self):
+    """Test that PFD works in a normal no-corner-cases case."""
+    created_issue_1 = fake.MakeTestIssue(
+        789, 1, 'issue summary', 'New', 111, reporter_id=111)
+    self.services.issue.TestAddIssue(created_issue_1)
+    local_id_1 = created_issue_1.local_id
+
+    mr = testing_helpers.MakeMonorailRequest(
+        project=self.project,
+        perms=permissions.OWNER_ACTIVE_PERMISSIONSET,
+        user_info={'user_id': 111})
+    mr.local_id_list = [local_id_1]
+
+    post_data = fake.PostData(
+        owner=['owner@example.com'],
+        can=[1],
+        q=[''],
+        colspec=[''],
+        sort=[''],
+        groupby=[''],
+        start=[0],
+        num=[100],
+        label=['freeze_new_label'])
+    self._MockMethods()
+    self.servlet.response = flask.Response()
+    self.servlet.ProcessFormData(mr, post_data)
+    self.assertEqual(
+        (
+            "The creation of new labels is blocked for the Chromium project"
+            " in Monorail. To continue with editing your issue, please"
+            " remove: freeze_new_label label(s)."), mr.errors.labels)
+
   def testProcessFormData_NoIssues(self):
     """Test PFD when no issues are specified."""
     mr = testing_helpers.MakeMonorailRequest(
@@ -233,10 +263,10 @@
         perms=permissions.OWNER_ACTIVE_PERMISSIONSET,
         user_info={'user_id': 111})
     post_data = fake.PostData()
-    self.servlet.response = Response()
+    self.servlet.response = flask.Response()
     self.servlet.ProcessFormData(mr, post_data)
     # 400 == bad request
-    self.assertEqual(400, self.servlet.response.status)
+    self.assertEqual(400, self.servlet.response.status_code)
 
   def testProcessFormData_NoUser(self):
     """Test PFD when the user is not logged in."""
@@ -244,10 +274,10 @@
         project=self.project)
     mr.local_id_list = [99999]
     post_data = fake.PostData()
-    self.servlet.response = Response()
+    self.servlet.response = flask.Response()
     self.servlet.ProcessFormData(mr, post_data)
     # 400 == bad request
-    self.assertEqual(400, self.servlet.response.status)
+    self.assertEqual(400, self.servlet.response.status_code)
 
   def testProcessFormData_CantComment(self):
     """Test PFD when the user can't comment on any of the issues."""
@@ -257,10 +287,10 @@
         user_info={'user_id': 111})
     mr.local_id_list = [99999]
     post_data = fake.PostData()
-    self.servlet.response = Response()
+    self.servlet.response = flask.Response()
     self.servlet.ProcessFormData(mr, post_data)
     # 400 == bad request
-    self.assertEqual(400, self.servlet.response.status)
+    self.assertEqual(400, self.servlet.response.status_code)
 
   def testProcessFormData_CantEdit(self):
     """Test PFD when the user can't edit any issue metadata."""
@@ -270,10 +300,10 @@
         user_info={'user_id': 111})
     mr.local_id_list = [99999]
     post_data = fake.PostData()
-    self.servlet.response = Response()
+    self.servlet.response = flask.Response()
     self.servlet.ProcessFormData(mr, post_data)
     # 400 == bad request
-    self.assertEqual(400, self.servlet.response.status)
+    self.assertEqual(400, self.servlet.response.status_code)
 
   def testProcessFormData_CantMove(self):
     """Test PFD when the user can't move issues."""
@@ -283,10 +313,10 @@
         user_info={'user_id': 111})
     mr.local_id_list = [99999]
     post_data = fake.PostData(move_to=['proj'])
-    self.servlet.response = Response()
+    self.servlet.response = flask.Response()
     self.servlet.ProcessFormData(mr, post_data)
     # 400 == bad request
-    self.assertEqual(400, self.servlet.response.status)
+    self.assertEqual(400, self.servlet.response.status_code)
 
     created_issue_1 = fake.MakeTestIssue(
         789, 1, 'issue summary', 'New', 111, reporter_id=111)
@@ -699,7 +729,7 @@
 
     # Verify CC lists and owner were merged to the merge_into issue.
     self.assertEqual(
-            [113, 120, 114, 115, 118, 111], merge_into_issue.cc_ids)
+            [113, 120, 111, 114, 115, 118], merge_into_issue.cc_ids)
     # Verify new starrers were added to the merge_into issue.
     self.assertEqual(4,
                       self.services.issue_star.CountItemStars(
@@ -801,7 +831,7 @@
     self.assertEqual('Invalid issue ID 54321', mr.errors.blocking)
 
   def testProcessFormData_BlockIssuesOnItself(self):
-    """Test PFD processes invalid blocked_on and blocking values."""
+    """Test PFD processes same issue blocked_on and blocking values."""
     created_issue_1 = fake.MakeTestIssue(
         789, 1, 'issue summary', 'New', 111, reporter_id=111)
     self.services.issue.TestAddIssue(created_issue_1)
@@ -828,6 +858,49 @@
     self.assertEqual('Cannot block an issue on itself.', mr.errors.blocked_on)
     self.assertEqual('Cannot block an issue on itself.', mr.errors.blocking)
 
+  def testProcessFormData_BlockIssuesOnArchivedProject(self):
+    """Test PFD processes blocked_on and blocking issues without permissions."""
+    created_issue_1 = fake.MakeTestIssue(
+        789, 1, 'issue summary', 'New', 111, reporter_id=111)
+    self.services.issue.TestAddIssue(created_issue_1)
+    local_id_1 = created_issue_1.local_id
+    # Add issue to archived project.
+    archived_proj = self.services.project.TestAddProject(
+        name='archived-proj', project_id=789987, owner_ids=[111])
+    archived_proj.state = project_pb2.ProjectState.ARCHIVED
+    archived_iid = 2
+    created_issue_2 = fake.MakeTestIssue(
+        789987, archived_iid, 'issue summary', 'New', 111, reporter_id=111)
+    self.services.issue.TestAddIssue(created_issue_2)
+    mr = testing_helpers.MakeMonorailRequest(
+        project=self.project,
+        perms=permissions.OWNER_ACTIVE_PERMISSIONSET,
+        user_info={'user_id': 111})
+    mr.project_name = 'proj'
+    mr.local_id_list = [local_id_1]
+
+    global_id = 'archived-proj:2'
+    self._MockMethods()
+    post_data = fake.PostData(
+        op_blockedonenter=['append'],
+        blocked_on=[global_id],
+        op_blockingenter=['append'],
+        blocking=[global_id],
+        can=[1],
+        q=[''],
+        colspec=[''],
+        sort=[''],
+        groupby=[''],
+        start=[0],
+        num=[100])
+    self.servlet.ProcessFormData(mr, post_data)
+
+    self.assertEqual(
+        'Target issue %s cannot be modified' % archived_iid,
+        mr.errors.blocked_on)
+    self.assertEqual(
+        'Target issue %s cannot be modified' % archived_iid, mr.errors.blocking)
+
   @mock.patch('framework.cloud_tasks_helpers.create_task')
   def testProcessFormData_NormalBlockIssues(self, _create_task_mock):
     """Test PFD processes blocked_on and blocking values."""
diff --git a/tracker/test/issuedetailezt_test.py b/tracker/test/issuedetailezt_test.py
index fe3d22f..fe51ddf 100644
--- a/tracker/test/issuedetailezt_test.py
+++ b/tracker/test/issuedetailezt_test.py
@@ -1,7 +1,6 @@
-# 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.
 
 """Unittests for monorail.tracker.issuedetailezt."""
 from __future__ import print_function
@@ -19,7 +18,7 @@
 
 import settings
 from businesslogic import work_env
-from proto import features_pb2
+from mrproto import features_pb2
 from features import hotlist_views
 from features import send_notifications
 from framework import authdata
@@ -31,9 +30,9 @@
 from framework import profiler
 from framework import sorting
 from framework import template_helpers
-from proto import project_pb2
-from proto import tracker_pb2
-from proto import user_pb2
+from mrproto import project_pb2
+from mrproto import tracker_pb2
+from mrproto import user_pb2
 from services import service_manager
 from services import issue_svc
 from services import tracker_fulltext
@@ -144,12 +143,9 @@
         project=fake.ProjectService())
     self.project = self.services.project.TestAddProject(
       'proj', project_id=987, committer_ids=[111])
-    self.next_servlet = issuedetailezt.FlipperNext(
-        'req', 'res', services=self.services)
-    self.prev_servlet = issuedetailezt.FlipperPrev(
-        'req', 'res', services=self.services)
-    self.list_servlet = issuedetailezt.FlipperList(
-        'req', 'res', services=self.services)
+    self.next_servlet = issuedetailezt.FlipperNext(services=self.services)
+    self.prev_servlet = issuedetailezt.FlipperPrev(services=self.services)
+    self.list_servlet = issuedetailezt.FlipperList(services=self.services)
     mr = testing_helpers.MakeMonorailRequest(project=self.project)
     mr.local_id = 123
     mr.me_user_id = 111
@@ -177,7 +173,7 @@
     patchGetAdjacentIssue.return_value = self.fake_issue_2
     self.next_servlet.mr.GetIntParam = mock.Mock(return_value=None)
 
-    self.next_servlet.get(project_name='proj', viewed_username=None)
+    self.next_servlet.get()
     self.next_servlet.mr.GetIntParam.assert_called_once_with('hotlist_id')
     patchGetAdjacentIssue.assert_called_once()
     self.next_servlet.redirect.assert_called_once_with(
@@ -189,7 +185,7 @@
     self.next_servlet.mr.GetIntParam = mock.Mock(return_value=123)
     # TODO(jeffcarp): Mock hotlist_id param on path here.
 
-    self.next_servlet.get(project_name='proj', viewed_username=None)
+    self.next_servlet.get()
     self.next_servlet.mr.GetIntParam.assert_called_with('hotlist_id')
     self.next_servlet.redirect.assert_called_once_with(
       '/p/potato/issues/detail?id=789')
@@ -199,7 +195,7 @@
     patchGetAdjacentIssue.return_value = self.fake_issue_2
     self.next_servlet.mr.GetIntParam = mock.Mock(return_value=None)
 
-    self.prev_servlet.get(project_name='proj', viewed_username=None)
+    self.prev_servlet.get()
     self.prev_servlet.mr.GetIntParam.assert_called_with('hotlist_id')
     patchGetAdjacentIssue.assert_called_once()
     self.prev_servlet.redirect.assert_called_once_with(
@@ -211,7 +207,7 @@
     self.prev_servlet.mr.GetIntParam = mock.Mock(return_value=123)
     # TODO(jeffcarp): Mock hotlist_id param on path here.
 
-    self.prev_servlet.get(project_name='proj', viewed_username=None)
+    self.prev_servlet.get()
     self.prev_servlet.mr.GetIntParam.assert_called_with('hotlist_id')
     self.prev_servlet.redirect.assert_called_once_with(
       '/p/potato/issues/detail?id=789')
diff --git a/tracker/test/issueentry_test.py b/tracker/test/issueentry_test.py
index b7461ae..b18f70b 100644
--- a/tracker/test/issueentry_test.py
+++ b/tracker/test/issueentry_test.py
@@ -1,7 +1,6 @@
-# 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.
 
 """Unittests for the issueentry servlet."""
 from __future__ import print_function
@@ -19,7 +18,6 @@
 
 from google.appengine.ext import testbed
 from mock import Mock, patch
-import webapp2
 
 from framework import framework_bizobj
 from framework import framework_views
@@ -30,8 +28,8 @@
 from testing import testing_helpers
 from tracker import issueentry
 from tracker import tracker_bizobj
-from proto import tracker_pb2
-from proto import user_pb2
+from mrproto import tracker_pb2
+from mrproto import user_pb2
 
 
 class IssueEntryTest(unittest.TestCase):
@@ -51,10 +49,7 @@
         template=Mock(spec=template_svc.TemplateService),
         features=fake.FeaturesService())
     self.project = self.services.project.TestAddProject('proj', project_id=987)
-    request = webapp2.Request.blank('/p/proj/issues/entry')
-    response = webapp2.Response()
-    self.servlet = issueentry.IssueEntry(
-        request, response, services=self.services)
+    self.servlet = issueentry.IssueEntry(services=self.services)
     self.user = self.services.user.TestAddUser('to_pass_tests', 0)
     self.services.features.TestAddHotlist(
         name='dontcare', summary='', owner_ids=[0])
@@ -752,6 +747,46 @@
     self.assertEqual(field_values[0].int_value, 3)
     self.assertEqual(field_values[1].int_value, 3737)
 
+  def testProcessFormData_RejectNewLabels(self):
+    """We raise an AssertionError when new labels are added."""
+    mr = testing_helpers.MakeMonorailRequest(path='/p/proj/issues/entry')
+    mr.perms = permissions.USER_PERMISSIONSET
+    mr.auth.user_view = framework_views.StuffUserView(100, 'user@invalid', True)
+    post_data = fake.PostData(
+        template_name=['rutabaga'],
+        summary=['Nya nya I modified the summary'],
+        comment=[self.template.content],
+        status=['New'],
+        label=['freeze_new_label'])
+
+    self.mox.StubOutWithMock(self.servlet, 'PleaseCorrect')
+    self.servlet.PleaseCorrect(
+        mr,
+        component_required=None,
+        fields=[],
+        initial_blocked_on='',
+        initial_blocking='',
+        initial_cc='',
+        initial_comment=self.template.content,
+        initial_components='',
+        initial_owner='',
+        initial_status='New',
+        initial_summary='Nya nya I modified the summary',
+        initial_hotlists='',
+        labels=['freeze_new_label'],
+        template_name='rutabaga')
+    self.mox.ReplayAll()
+    url = self.servlet.ProcessFormData(mr, post_data)
+    self.mox.VerifyAll()
+    self.assertEqual(
+        (
+            "The creation of new labels is blocked for the Chromium project"
+            " in Monorail. To continue with editing your issue, please"
+            " remove: freeze_new_label label(s)."),
+        mr.errors.labels,
+    )
+    self.assertIsNone(url)
+
   def testProcessFormData_RejectRestrictedFields(self):
     """We raise an AssertionError when restricted fields are set w/o perms."""
     mr = testing_helpers.MakeMonorailRequest(
diff --git a/tracker/test/issueexport_test.py b/tracker/test/issueexport_test.py
index 4e70ab7..7d51c84 100644
--- a/tracker/test/issueexport_test.py
+++ b/tracker/test/issueexport_test.py
@@ -1,19 +1,19 @@
-# 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.
 
 """Unittests for the issueexport servlet."""
 from __future__ import print_function
 from __future__ import division
 from __future__ import absolute_import
 
+import six
 import unittest
 
 from mock import Mock, patch
 
 from framework import permissions
-from proto import tracker_pb2
+from mrproto import tracker_pb2
 from services import service_manager
 from testing import testing_helpers
 from testing import fake
@@ -32,10 +32,8 @@
     )
     self.cnxn = 'fake connection'
     self.project = self.services.project.TestAddProject('proj', project_id=789)
-    self.servlet = issueexport.IssueExport(
-        'req', 'res', services=self.services)
-    self.jsonfeed = issueexport.IssueExportJSON(
-        'req', 'res', services=self.services)
+    self.servlet = issueexport.IssueExport(services=self.services)
+    self.jsonfeed = issueexport.IssueExportJSON(services=self.services)
     self.mr = testing_helpers.MakeMonorailRequest(
         project=self.project, perms=permissions.OWNER_ACTIVE_PERMISSIONSET)
     self.mr.can = 1
@@ -62,8 +60,8 @@
                      {'version': 1, 'who': None, 'when': 1234,
                       'project': 'proj', 'start': 0, 'num': 100})
     self.assertEqual(json_data['issues'], [])
-    self.assertItemsEqual(
-        json_data['emails'], ['user1@test.com', 'user2@test.com'])
+    six.assertCountEqual(
+        self, json_data['emails'], ['user1@test.com', 'user2@test.com'])
 
   # TODO(jojwang): test attachments, amendments, comment details
   def testMakeIssueJSON(self):
diff --git a/tracker/test/issueimport_test.py b/tracker/test/issueimport_test.py
index c0e38af..05c7526 100644
--- a/tracker/test/issueimport_test.py
+++ b/tracker/test/issueimport_test.py
@@ -1,7 +1,6 @@
-# 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.
 
 """Unittests for the issueimport servlet."""
 from __future__ import print_function
@@ -14,15 +13,14 @@
 from services import service_manager
 from testing import testing_helpers
 from tracker import issueimport
-from proto import tracker_pb2
+from mrproto import tracker_pb2
 
 
 class IssueExportTest(unittest.TestCase):
 
   def setUp(self):
     self.services = service_manager.Services()
-    self.servlet = issueimport.IssueImport(
-        'req', 'res', services=self.services)
+    self.servlet = issueimport.IssueImport(services=self.services)
     self.event_log = None
 
   def testAssertBasePermission(self):
@@ -37,6 +35,12 @@
   def testParseComment(self):
     """Test a Comment JSON is correctly parsed."""
     users_id_dict = {'adam@test.com': 111}
+    config = {
+        'component_defs': [{
+            'path': 'comp1',
+            'component_id': 1,
+        }],
+    }
     json = {
         'timestamp': 123,
         'commenter': 'adam@test.com',
@@ -46,7 +50,12 @@
         'description_num': None,
         }
     comment = self.servlet._ParseComment(
-        12, users_id_dict, json, self.event_log)
+        12,
+        users_id_dict,
+        json,
+        self.event_log,
+        config,
+    )
     self.assertEqual(
         comment, tracker_pb2.IssueComment(
             project_id=12, timestamp=123, user_id=111,
@@ -61,7 +70,7 @@
         'attachments': [],
     }
     desc_comment = self.servlet._ParseComment(
-        12, users_id_dict, json_desc, self.event_log)
+        12, users_id_dict, json_desc, self.event_log, config)
     self.assertEqual(
         desc_comment, tracker_pb2.IssueComment(
             project_id=12, timestamp=223, user_id=111,
diff --git a/tracker/test/issueoriginal_test.py b/tracker/test/issueoriginal_test.py
index 1b2b7d6..ff4e44e 100644
--- a/tracker/test/issueoriginal_test.py
+++ b/tracker/test/issueoriginal_test.py
@@ -1,7 +1,6 @@
-# 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.
 
 """Tests for the issueoriginal module."""
 from __future__ import print_function
@@ -11,13 +10,9 @@
 import mock
 import unittest
 
-import webapp2
-
 from framework import exceptions
-from framework import framework_helpers
-from framework import monorailrequest
 from framework import permissions
-from proto import tracker_pb2
+from mrproto import tracker_pb2
 from services import service_manager
 from testing import fake
 from testing import testing_helpers
@@ -45,8 +40,7 @@
         config=fake.ConfigService(),
         issue=fake.IssueService(),
         user=fake.UserService())
-    self.servlet = issueoriginal.IssueOriginal(
-        'req', 'res', services=self.services)
+    self.servlet = issueoriginal.IssueOriginal(services=self.services)
 
     self.proj = self.services.project.TestAddProject('proj', project_id=789)
     summary = 'System wont boot'
@@ -171,14 +165,14 @@
     _request, mr = testing_helpers.GetRequestObjects(
         path='/p/proj/issues/original',
         project=self.proj)
-    with self.assertRaises(webapp2.HTTPException) as cm:
+    with self.assertRaises(Exception) as cm:
       self.servlet.GatherPageData(mr)
     self.assertEqual(404, cm.exception.code)
 
     _request, mr = testing_helpers.GetRequestObjects(
         path='/p/proj/issues/original?id=1&seq=999',
         project=self.proj)
-    with self.assertRaises(webapp2.HTTPException) as cm:
+    with self.assertRaises(Exception) as cm:
       self.servlet.GatherPageData(mr)
     self.assertEqual(404, cm.exception.code)
 
@@ -200,7 +194,7 @@
     _request, mr = testing_helpers.GetRequestObjects(
         path='/p/proj/issues/original?id=1&seq=99',
         project=self.proj)
-    with self.assertRaises(webapp2.HTTPException) as cm:
+    with self.assertRaises(Exception) as cm:
       self.servlet._GetIssueAndComment(mr)
     self.assertEqual(404, cm.exception.code)
 
@@ -208,14 +202,14 @@
     _request, mr = testing_helpers.GetRequestObjects(
         path='/p/proj/issues/original',
         project=self.proj)
-    with self.assertRaises(webapp2.HTTPException) as cm:
+    with self.assertRaises(Exception) as cm:
       self.servlet._GetIssueAndComment(mr)
     self.assertEqual(404, cm.exception.code)
 
     _request, mr = testing_helpers.GetRequestObjects(
         path='/p/proj/issues/original?id=1',
         project=self.proj)
-    with self.assertRaises(webapp2.HTTPException) as cm:
+    with self.assertRaises(Exception) as cm:
       self.servlet._GetIssueAndComment(mr)
     self.assertEqual(404, cm.exception.code)
 
diff --git a/tracker/test/issuereindex_test.py b/tracker/test/issuereindex_test.py
index 715da9a..9929076 100644
--- a/tracker/test/issuereindex_test.py
+++ b/tracker/test/issuereindex_test.py
@@ -1,7 +1,6 @@
-# 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.
 
 """Unittests for monorail.tracker.issuereindex."""
 from __future__ import print_function
@@ -17,7 +16,6 @@
 
 import settings
 from framework import permissions
-from framework import template_helpers
 from services import service_manager
 from services import tracker_fulltext
 from testing import fake
@@ -45,27 +43,25 @@
     # 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(
+      _, mr = testing_helpers.GetRequestObjects(
           project=self.project, perms=permission)
-      servlet = issuereindex.IssueReindex(
-          request, 'res', services=self.services)
+      servlet = issuereindex.IssueReindex(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)
+    self.assertEqual(
+        'You are not allowed to administer this project', str(cm.exception))
 
   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(
+      _, mr = testing_helpers.GetRequestObjects(
           project=self.project, perms=permission)
-      servlet = issuereindex.IssueReindex(
-          request, 'res', services=self.services)
+      servlet = issuereindex.IssueReindex(services=self.services)
       servlet.AssertBasePermission(mr)
 
   def testGatherPageData(self):
-    servlet = issuereindex.IssueReindex('req', 'res', services=self.services)
+    servlet = issuereindex.IssueReindex(services=self.services)
 
     mr = testing_helpers.MakeMonorailRequest()
     mr.auto_submit = True
@@ -76,7 +72,7 @@
     self.assertTrue(ret['page_perms'].CreateIssue)
 
   def _callProcessFormData(self, post_data, index_issue_1=True):
-    servlet = issuereindex.IssueReindex('req', 'res', services=self.services)
+    servlet = issuereindex.IssueReindex(services=self.services)
 
     mr = testing_helpers.MakeMonorailRequest(project=self.project)
     mr.cnxn = self.cnxn
@@ -103,13 +99,13 @@
     post_data = {'start': 1, 'num': 5}
     ret = self._callProcessFormData(post_data)
     self.assertEqual(
-        '/p/None/issues/reindex?start=6&auto_submit=False&num=5', ret)
+        '/p/None/issues/reindex?start=6&num=5&auto_submit=False', ret)
 
   def testProcessFormData_LargeInputs(self):
     post_data = {'start': 0, 'num': 10000000}
     ret = self._callProcessFormData(post_data)
     self.assertEqual(
-        '/p/None/issues/reindex?start=%s&auto_submit=False&num=%s' % (
+        '/p/None/issues/reindex?start=%s&num=%s&auto_submit=False' % (
             settings.max_artifact_search_results_per_page,
             settings.max_artifact_search_results_per_page), ret)
 
@@ -117,11 +113,11 @@
     post_data = {'start': 1, 'num': 5, 'auto_submit': 1}
     ret = self._callProcessFormData(post_data)
     self.assertEqual(
-        '/p/None/issues/reindex?start=6&auto_submit=True&num=5', ret)
+        '/p/None/issues/reindex?start=6&num=5&auto_submit=True', ret)
 
   def testProcessFormData_WithAutoSubmitButNoMoreIssues(self):
     """This project has no issues 6-10, so stop autosubmitting."""
     post_data = {'start': 6, 'num': 5, 'auto_submit': 1}
     ret = self._callProcessFormData(post_data, index_issue_1=False)
     self.assertEqual(
-        '/p/None/issues/reindex?start=11&auto_submit=False&num=5', ret)
+        '/p/None/issues/reindex?start=11&num=5&auto_submit=False', ret)
diff --git a/tracker/test/issuetips_test.py b/tracker/test/issuetips_test.py
index 44f5f70..9734b92 100644
--- a/tracker/test/issuetips_test.py
+++ b/tracker/test/issuetips_test.py
@@ -1,7 +1,6 @@
-# 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.
 
 """Tests for issuetips module."""
 from __future__ import print_function
@@ -24,8 +23,7 @@
         issue=fake.IssueService(),
         user=fake.UserService(),
         project=fake.ProjectService())
-    self.servlet = issuetips.IssueSearchTips(
-        'req', 'res', services=self.services)
+    self.servlet = issuetips.IssueSearchTips(services=self.services)
 
   def testGatherPageData(self):
     mr = testing_helpers.MakeMonorailRequest(path='/p/proj/issues/tips')
diff --git a/tracker/test/rerank_helpers_test.py b/tracker/test/rerank_helpers_test.py
index 47ddd47..d550f53 100644
--- a/tracker/test/rerank_helpers_test.py
+++ b/tracker/test/rerank_helpers_test.py
@@ -1,7 +1,6 @@
-# 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.
 
 """Unittests for monorail.tracker.rerank_helpers."""
 from __future__ import print_function
diff --git a/tracker/test/tablecell_test.py b/tracker/test/tablecell_test.py
index c8b7292..e50efd2 100644
--- a/tracker/test/tablecell_test.py
+++ b/tracker/test/tablecell_test.py
@@ -1,7 +1,6 @@
-# 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 issuelist module."""
 from __future__ import print_function
@@ -14,7 +13,7 @@
 from framework import framework_constants
 from framework import table_view_helpers
 from framework import template_helpers
-from proto import tracker_pb2
+from mrproto import tracker_pb2
 from testing import fake
 from testing import testing_helpers
 from tracker import tablecell
diff --git a/tracker/test/template_helpers_test.py b/tracker/test/template_helpers_test.py
index 6c4a034..982e8bd 100644
--- a/tracker/test/template_helpers_test.py
+++ b/tracker/test/template_helpers_test.py
@@ -1,7 +1,6 @@
-# Copyright 2018 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 2018 The Chromium Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
 
 """Unittest for the template helpers module."""
 from __future__ import print_function
@@ -9,6 +8,7 @@
 from __future__ import absolute_import
 
 import logging
+import six
 import unittest
 
 import settings
@@ -18,7 +18,7 @@
 from testing import testing_helpers
 from tracker import template_helpers
 from tracker import tracker_bizobj
-from proto import tracker_pb2
+from mrproto import tracker_pb2
 
 
 class TemplateHelpers(unittest.TestCase):
@@ -87,7 +87,7 @@
     self.assertFalse(parsed.component_required)
     self.assertFalse(parsed.owner_defaults_to_member)
     self.assertFalse(parsed.add_approvals)
-    self.assertItemsEqual(parsed.phase_names, ['', '', '', '', '', ''])
+    six.assertCountEqual(self, parsed.phase_names, ['', '', '', '', '', ''])
     self.assertEqual(parsed.approvals_to_phase_idx, {})
     self.assertEqual(parsed.required_approval_ids, [])
 
@@ -139,10 +139,11 @@
     self.assertFalse(parsed.owner_defaults_to_member)
     self.assertTrue(parsed.add_approvals)
     self.assertEqual(parsed.admin_str, 'jojwang@test.com, annajo@test.com')
-    self.assertItemsEqual(parsed.phase_names,
-                          ['Canary', 'Stable-Exp', 'Stable', '', '', 'Oops'])
+    six.assertCountEqual(
+        self, parsed.phase_names,
+        ['Canary', 'Stable-Exp', 'Stable', '', '', 'Oops'])
     self.assertEqual(parsed.approvals_to_phase_idx, {3: 2, 4: None})
-    self.assertItemsEqual(parsed.required_approval_ids, [3, 4])
+    six.assertCountEqual(self, parsed.required_approval_ids, [3, 4])
 
   def testGetTemplateInfoFromParsed_Normal(self):
     self.config.field_defs.extend([self.fd_1, self.fd_2])
@@ -269,8 +270,7 @@
     (prechecked_approvals, required_approval_ids,
      phases) = template_helpers.GatherApprovalsPageData(
          approval_values, tmpl_phases, self.config)
-    self.assertItemsEqual(prechecked_approvals,
-                          ['4_phase_0', '5'])
+    six.assertCountEqual(self, prechecked_approvals, ['4_phase_0', '5'])
     self.assertEqual(required_approval_ids, [4])
     self.assertEqual(phases[0], tmpl_phases[1])
     self.assertIsNone(phases[1].name)
@@ -280,8 +280,7 @@
     approvals_to_phase_idx = {23: 0, 25: 1, 26: None}
     checked = template_helpers.GetCheckedApprovalsFromParsed(
         approvals_to_phase_idx)
-    self.assertItemsEqual(checked,
-                          ['23_phase_0', '25_phase_1', '26'])
+    six.assertCountEqual(self, checked, ['23_phase_0', '25_phase_1', '26'])
 
   def testGetIssueFromTemplate(self):
     """Can fill and return the templated issue"""
diff --git a/tracker/test/templatecreate_test.py b/tracker/test/templatecreate_test.py
index 78664c0..442bf8b 100644
--- a/tracker/test/templatecreate_test.py
+++ b/tracker/test/templatecreate_test.py
@@ -1,7 +1,6 @@
-# Copyright 2018 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 2018 The Chromium Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
 
 """Unit test for Template creation servlet."""
 from __future__ import print_function
@@ -27,7 +26,7 @@
 from tracker import templatecreate
 from tracker import tracker_bizobj
 from tracker import tracker_views
-from proto import tracker_pb2
+from mrproto import tracker_pb2
 
 
 class TemplateCreateTest(unittest.TestCase):
@@ -40,8 +39,7 @@
         config=fake.ConfigService(),
         template=Mock(spec=template_svc.TemplateService),
         user=fake.UserService())
-    self.servlet = templatecreate.TemplateCreate('req', 'res',
-        services=self.services)
+    self.servlet = templatecreate.TemplateCreate(services=self.services)
     self.project = self.services.project.TestAddProject('proj')
 
     self.fd_1 = tracker_bizobj.MakeFieldDef(
@@ -372,6 +370,16 @@
                 tracker_pb2.ApprovalStatus.NEEDS_REVIEW), phase_id=1)
         ]
     self.services.template.CreateIssueTemplateDef.assert_called_once_with(
-        self.mr.cnxn, 47925, 'secondtemplate', 'HEY WHY', 'TLDR', True,
-        'Accepted', True, False, True, 0, ['label-One', 'label-Two'], [], [],
-        [fv], phases=phases, approval_values=approval_values)
+        self.mr.cnxn,
+        self.mr.project_id,
+        'secondtemplate',
+        'HEY WHY',
+        'TLDR',
+        True,
+        'Accepted',
+        True,
+        False,
+        True,
+        0, ['label-One', 'label-Two'], [], [], [fv],
+        phases=phases,
+        approval_values=approval_values)
diff --git a/tracker/test/templatedetail_test.py b/tracker/test/templatedetail_test.py
index 42fc46b..3968554 100644
--- a/tracker/test/templatedetail_test.py
+++ b/tracker/test/templatedetail_test.py
@@ -1,7 +1,6 @@
-# Copyright 2018 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 2018 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 Template editing/viewing servlet."""
 from __future__ import print_function
@@ -13,6 +12,7 @@
 except ImportError:
   import mox
 import logging
+import six
 import unittest
 import settings
 
@@ -27,7 +27,7 @@
 from testing import testing_helpers
 from tracker import templatedetail
 from tracker import tracker_bizobj
-from proto import tracker_pb2
+from mrproto import tracker_pb2
 
 
 class TemplateDetailTest(unittest.TestCase):
@@ -41,8 +41,7 @@
                                              template=mock_template_service,
                                              usergroup=fake.UserGroupService(),
                                              user=fake.UserService())
-    self.servlet = templatedetail.TemplateDetail('req', 'res',
-                                               services=self.services)
+    self.servlet = templatedetail.TemplateDetail(services=self.services)
 
     self.services.user.TestAddUser('gatsby@example.com', 111)
     self.services.user.TestAddUser('sport@example.com', 222)
@@ -271,8 +270,8 @@
     self.assertTrue(page_data['initial_owner_defaults_to_member'])
     self.assertEqual(page_data['initial_components'], 'BackEnd')
     self.assertFalse(page_data['initial_component_required'])
-    self.assertItemsEqual(
-        page_data['labels'],
+    six.assertCountEqual(
+        self, page_data['labels'],
         ['label1', 'label2', 'GateTarget-Should-Not', 'GateTarget-Be-Masked'])
     self.assertEqual(page_data['initial_admins'], 'sport@example.com')
     self.assertTrue(page_data['initial_add_approvals'])
@@ -280,8 +279,8 @@
     phases = [phase for phase in page_data['initial_phases'] if phase.name]
     self.assertEqual(len(phases), 2)
     self.assertEqual(len(page_data['approvals']), 2)
-    self.assertItemsEqual(page_data['prechecked_approvals'],
-                          ['3_phase_0', '4_phase_1'])
+    six.assertCountEqual(
+        self, page_data['prechecked_approvals'], ['3_phase_0', '4_phase_1'])
     self.assertTrue(page_data['fields'][3].is_editable)  #nonRestrictedField
     self.assertIsNone(page_data['fields'][4].is_editable)  #restrictedField
 
@@ -439,7 +438,7 @@
 
     self.services.template.UpdateIssueTemplateDef.assert_called_once_with(
         self.mr.cnxn,
-        47925,
+        self.mr.project_id,
         12345,
         status='Accepted',
         component_required=True,
@@ -496,19 +495,32 @@
     self.assertTrue('/templates/detail?saved=1&template=TestTemplate&' in url)
 
     self.services.template.UpdateIssueTemplateDef.assert_called_once_with(
-        self.mr.cnxn, 47925, 12345, status='Accepted', component_required=True,
+        self.mr.cnxn,
+        self.mr.project_id,
+        12345,
+        status='Accepted',
+        component_required=True,
         phases=[
             tracker_pb2.Phase(name='Canary', rank=0, phase_id=0),
-            tracker_pb2.Phase(name='Stable', rank=1, phase_id=1)],
-        approval_values=[tracker_pb2.ApprovalValue(approval_id=3, phase_id=0),
-                         tracker_pb2.ApprovalValue(approval_id=4, phase_id=1)],
-        name='TestTemplate', field_values=[
+            tracker_pb2.Phase(name='Stable', rank=1, phase_id=1)
+        ],
+        approval_values=[
+            tracker_pb2.ApprovalValue(approval_id=3, phase_id=0),
+            tracker_pb2.ApprovalValue(approval_id=4, phase_id=1)
+        ],
+        name='TestTemplate',
+        field_values=[
             tracker_pb2.FieldValue(field_id=1, str_value='NO', derived=False),
-            tracker_pb2.FieldValue(
-                field_id=2, str_value='MOOD', derived=False)],
-        labels=['label-One', 'label-Two'], owner_defaults_to_member=True,
-        admin_ids=[], content='HEY WHY', component_ids=[1],
-        summary_must_be_edited=False, summary='TLDR', members_only=True,
+            tracker_pb2.FieldValue(field_id=2, str_value='MOOD', derived=False)
+        ],
+        labels=['label-One', 'label-Two'],
+        owner_defaults_to_member=True,
+        admin_ids=[],
+        content='HEY WHY',
+        component_ids=[1],
+        summary_must_be_edited=False,
+        summary='TLDR',
+        members_only=True,
         owner_id=333)
 
   def testProcessFormData_Delete(self):
@@ -521,4 +533,4 @@
 
     self.assertTrue('/p/None/adminTemplates?deleted=1' in url)
     self.services.template.DeleteIssueTemplateDef\
-        .assert_called_once_with(self.mr.cnxn, 47925, 12345)
+        .assert_called_once_with(self.mr.cnxn, self.mr.project_id, 12345)
diff --git a/tracker/test/tracker_bizobj_test.py b/tracker/test/tracker_bizobj_test.py
index 29351b0..603b7c5 100644
--- a/tracker/test/tracker_bizobj_test.py
+++ b/tracker/test/tracker_bizobj_test.py
@@ -1,7 +1,6 @@
-# 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.
 
 """Tests for issue  bizobj functions."""
 from __future__ import print_function
@@ -10,10 +9,11 @@
 
 import unittest
 import logging
+import six
 
 from framework import framework_constants
 from framework import framework_views
-from proto import tracker_pb2
+from mrproto import tracker_pb2
 from services import service_manager
 from testing import fake
 from testing import testing_helpers
@@ -77,8 +77,8 @@
     av_2 = tracker_pb2.ApprovalValue()
     av_3 = tracker_pb2.ApprovalValue(approver_ids=[222, 333])
     issue.approval_values = [av_1, av_2, av_3]
-    self.assertItemsEqual(
-        tracker_bizobj.GetApproverIds(issue), [111, 222, 333])
+    six.assertCountEqual(
+        self, tracker_bizobj.GetApproverIds(issue), [111, 222, 333])
 
   def testGetLabels(self):
     issue = tracker_pb2.Issue()
@@ -179,9 +179,9 @@
     config.field_defs = [subfd_1, subfd_2, subfd_3, subfd_4]
 
     subfields_dict = tracker_bizobj.FindApprovalsSubfields([1, 2], config)
-    self.assertItemsEqual(subfields_dict[1], [subfd_1, subfd_3])
-    self.assertItemsEqual(subfields_dict[2], [subfd_2])
-    self.assertItemsEqual(subfields_dict[3], [])
+    six.assertCountEqual(self, subfields_dict[1], [subfd_1, subfd_3])
+    six.assertCountEqual(self, subfields_dict[2], [subfd_2])
+    six.assertCountEqual(self, subfields_dict[3], [])
 
   def testFindPhaseByID_Normal(self):
     canary_phase = tracker_pb2.Phase(phase_id=2, name='Canary')
@@ -758,7 +758,7 @@
 
   def CheckDefaultConfig(self, config):
     self.assertTrue(len(config.well_known_statuses) > 0)
-    self.assertTrue(config.statuses_offer_merge > 0)
+    self.assertTrue(len(config.statuses_offer_merge) > 0)
     self.assertTrue(len(config.well_known_labels) > 0)
     self.assertTrue(len(config.exclusive_label_prefixes) > 0)
     # TODO(jrobbins): test actual values from default config
@@ -839,10 +839,10 @@
          'Pri-4'],
         result_labels[:result_labels.index('OpSys-All')])
     self.assertEqual('Pri -status', harmonized.default_sort_spec.strip())
-    self.assertItemsEqual(c1.field_defs + c2.field_defs,
-                          harmonized.field_defs)
-    self.assertItemsEqual(c1.approval_defs + c2.approval_defs,
-                          harmonized.approval_defs)
+    six.assertCountEqual(
+        self, c1.field_defs + c2.field_defs, harmonized.field_defs)
+    six.assertCountEqual(
+        self, c1.approval_defs + c2.approval_defs, harmonized.approval_defs)
 
   def testHarmonizeConfigsMeansOpen(self):
     c1 = tracker_bizobj.MakeDefaultProjectIssueConfig(789)
@@ -1778,8 +1778,8 @@
             default_project_name=issue.project_name)
     ]
     self.assertEqual(actual_amendments, expected_amendments)
-    self.assertItemsEqual(
-        actual_impacted_iids, [
+    six.assertCountEqual(
+        self, actual_impacted_iids, [
             blocked_on_add.issue_id, blocking_add.issue_id, blocked_on.issue_id,
             blocking.issue_id
         ])
@@ -1868,46 +1868,46 @@
 
   def testDiffValueLists(self):
     added, removed = tracker_bizobj.DiffValueLists([], [])
-    self.assertItemsEqual([], added)
-    self.assertItemsEqual([], removed)
+    six.assertCountEqual(self, [], added)
+    six.assertCountEqual(self, [], removed)
 
     added, removed = tracker_bizobj.DiffValueLists([], None)
-    self.assertItemsEqual([], added)
-    self.assertItemsEqual([], removed)
+    six.assertCountEqual(self, [], added)
+    six.assertCountEqual(self, [], removed)
 
     added, removed = tracker_bizobj.DiffValueLists([1, 2], [])
-    self.assertItemsEqual([1, 2], added)
-    self.assertItemsEqual([], removed)
+    six.assertCountEqual(self, [1, 2], added)
+    six.assertCountEqual(self, [], removed)
 
     added, removed = tracker_bizobj.DiffValueLists([], [8, 9])
-    self.assertItemsEqual([], added)
-    self.assertItemsEqual([8, 9], removed)
+    six.assertCountEqual(self, [], added)
+    six.assertCountEqual(self, [8, 9], removed)
 
     added, removed = tracker_bizobj.DiffValueLists([1, 2], [8, 9])
-    self.assertItemsEqual([1, 2], added)
-    self.assertItemsEqual([8, 9], removed)
+    six.assertCountEqual(self, [1, 2], added)
+    six.assertCountEqual(self, [8, 9], removed)
 
     added, removed = tracker_bizobj.DiffValueLists([1, 2, 5, 6], [5, 6, 8, 9])
-    self.assertItemsEqual([1, 2], added)
-    self.assertItemsEqual([8, 9], removed)
+    six.assertCountEqual(self, [1, 2], added)
+    six.assertCountEqual(self, [8, 9], removed)
 
     added, removed = tracker_bizobj.DiffValueLists([5, 6], [5, 6, 8, 9])
-    self.assertItemsEqual([], added)
-    self.assertItemsEqual([8, 9], removed)
+    six.assertCountEqual(self, [], added)
+    six.assertCountEqual(self, [8, 9], removed)
 
     added, removed = tracker_bizobj.DiffValueLists([1, 2, 5, 6], [5, 6])
-    self.assertItemsEqual([1, 2], added)
-    self.assertItemsEqual([], removed)
+    six.assertCountEqual(self, [1, 2], added)
+    six.assertCountEqual(self, [], removed)
 
     added, removed = tracker_bizobj.DiffValueLists(
         [1, 2, 2, 5, 6], [5, 6, 8, 9])
-    self.assertItemsEqual([1, 2, 2], added)
-    self.assertItemsEqual([8, 9], removed)
+    six.assertCountEqual(self, [1, 2, 2], added)
+    six.assertCountEqual(self, [8, 9], removed)
 
     added, removed = tracker_bizobj.DiffValueLists(
         [1, 2, 5, 6], [5, 6, 8, 8, 9])
-    self.assertItemsEqual([1, 2], added)
-    self.assertItemsEqual([8, 8, 9], removed)
+    six.assertCountEqual(self, [1, 2], added)
+    six.assertCountEqual(self, [8, 8, 9], removed)
 
   def testMakeFieldAmendment_NoSuchFieldDef(self):
     config = tracker_bizobj.MakeDefaultProjectIssueConfig(789)
@@ -2053,7 +2053,10 @@
         tracker_pb2.ComponentDef(component_id=2, path='DB')]
     self.assertEqual(
         tracker_bizobj.MakeAmendment(
-            tracker_pb2.FieldID.COMPONENTS, '-UI DB', [], []),
+            tracker_pb2.FieldID.COMPONENTS,
+            '-UI DB', [], [],
+            added_component_ids=[2],
+            removed_component_ids=[1]),
         tracker_bizobj.MakeComponentsAmendment([2], [1], config))
 
   def testMakeBlockedOnAmendment(self):
diff --git a/tracker/test/tracker_helpers_test.py b/tracker/test/tracker_helpers_test.py
index 4f89cc9..b7e930b 100644
--- a/tracker/test/tracker_helpers_test.py
+++ b/tracker/test/tracker_helpers_test.py
@@ -1,7 +1,6 @@
-# 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 2022 The Chromium Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
 
 """Unittest for the tracker helpers module."""
 from __future__ import print_function
@@ -11,6 +10,8 @@
 import copy
 import mock
 import unittest
+import io
+import six
 
 import settings
 
@@ -21,15 +22,16 @@
 from framework import permissions
 from framework import template_helpers
 from framework import urls
-from proto import project_pb2
-from proto import tracker_pb2
-from proto import user_pb2
+from mrproto import project_pb2
+from mrproto import tracker_pb2
+from mrproto import user_pb2
 from services import service_manager
 from testing import fake
 from testing import testing_helpers
 from tracker import tracker_bizobj
 from tracker import tracker_constants
 from tracker import tracker_helpers
+from werkzeug.datastructures import FileStorage
 
 TEST_ID_MAP = {
     'a@example.com': 1,
@@ -166,39 +168,39 @@
 
     add, remove = tracker_helpers._ClassifyPlusMinusItems(
         ['', ' ', '  \t', '-'])
-    self.assertItemsEqual([], add)
-    self.assertItemsEqual([], remove)
+    six.assertCountEqual(self, [], add)
+    six.assertCountEqual(self, [], remove)
 
     add, remove = tracker_helpers._ClassifyPlusMinusItems(
         ['a', 'b', 'c'])
-    self.assertItemsEqual(['a', 'b', 'c'], add)
-    self.assertItemsEqual([], remove)
+    six.assertCountEqual(self, ['a', 'b', 'c'], add)
+    six.assertCountEqual(self, [], remove)
 
     add, remove = tracker_helpers._ClassifyPlusMinusItems(
         ['a-a-a', 'b-b', 'c-'])
-    self.assertItemsEqual(['a-a-a', 'b-b', 'c-'], add)
-    self.assertItemsEqual([], remove)
+    six.assertCountEqual(self, ['a-a-a', 'b-b', 'c-'], add)
+    six.assertCountEqual(self, [], remove)
 
     add, remove = tracker_helpers._ClassifyPlusMinusItems(
         ['-a'])
-    self.assertItemsEqual([], add)
-    self.assertItemsEqual(['a'], remove)
+    six.assertCountEqual(self, [], add)
+    six.assertCountEqual(self, ['a'], remove)
 
     add, remove = tracker_helpers._ClassifyPlusMinusItems(
         ['-a', 'b', 'c-c'])
-    self.assertItemsEqual(['b', 'c-c'], add)
-    self.assertItemsEqual(['a'], remove)
+    six.assertCountEqual(self, ['b', 'c-c'], add)
+    six.assertCountEqual(self, ['a'], remove)
 
     add, remove = tracker_helpers._ClassifyPlusMinusItems(
         ['-a', '-b-b', '-c-'])
-    self.assertItemsEqual([], add)
-    self.assertItemsEqual(['a', 'b-b', 'c-'], remove)
+    six.assertCountEqual(self, [], add)
+    six.assertCountEqual(self, ['a', 'b-b', 'c-'], remove)
 
     # We dedup, but we don't cancel out items that are both added and removed.
     add, remove = tracker_helpers._ClassifyPlusMinusItems(
         ['a', 'a', '-a'])
-    self.assertItemsEqual(['a'], add)
-    self.assertItemsEqual(['a'], remove)
+    six.assertCountEqual(self, ['a'], add)
+    six.assertCountEqual(self, ['a'], remove)
 
   def testParseIssueRequestFields(self):
     parsed_fields = tracker_helpers._ParseIssueRequestFields(fake.PostData({
@@ -227,22 +229,25 @@
             }}))
 
   def testParseIssueRequestAttachments(self):
-    file1 = testing_helpers.Blank(
+    file1 = FileStorage(
+        stream=io.BytesIO(b'hello world'),
         filename='hello.c',
-        value='hello world')
-
-    file2 = testing_helpers.Blank(
+    )
+    file2 = FileStorage(
+        stream=io.BytesIO(b'Welcome to our project'),
         filename='README',
-        value='Welcome to our project')
+    )
 
-    file3 = testing_helpers.Blank(
+    file3 = FileStorage(
+        stream=io.BytesIO(b'Abort, Retry, or Fail?'),
         filename='c:\\dir\\subdir\\FILENAME.EXT',
-        value='Abort, Retry, or Fail?')
+    )
 
     # Browsers send this if FILE field was not filled in.
-    file4 = testing_helpers.Blank(
+    file4 = FileStorage(
+        stream=io.BytesIO(b''),
         filename='',
-        value='')
+    )
 
     attachments = tracker_helpers._ParseIssueRequestAttachments({})
     self.assertEqual([], attachments)
@@ -250,26 +255,31 @@
     attachments = tracker_helpers._ParseIssueRequestAttachments(fake.PostData({
         'file1': [file1],
         }))
-    self.assertEqual(
-        [('hello.c', 'hello world', 'text/plain')],
-        attachments)
+    self.assertEqual([('hello.c', b'hello world', 'text/plain')], attachments)
+    file1.seek(0)
 
     attachments = tracker_helpers._ParseIssueRequestAttachments(fake.PostData({
         'file1': [file1],
         'file2': [file2],
         }))
     self.assertEqual(
-        [('hello.c', 'hello world', 'text/plain'),
-         ('README', 'Welcome to our project', 'text/plain')],
-        attachments)
+        [
+            ('hello.c', b'hello world', 'text/plain'),
+            ('README', b'Welcome to our project', 'text/plain')
+        ], attachments)
+    file1.seek(0)
+    file2.seek(0)
 
     attachments = tracker_helpers._ParseIssueRequestAttachments(fake.PostData({
         'file3': [file3],
         }))
     self.assertEqual(
-        [('FILENAME.EXT', 'Abort, Retry, or Fail?',
-          'application/octet-stream')],
-        attachments)
+        [
+            (
+                'FILENAME.EXT', b'Abort, Retry, or Fail?',
+                'application/octet-stream')
+        ], attachments)
+    file3.seek(0)
 
     attachments = tracker_helpers._ParseIssueRequestAttachments(fake.PostData({
         'file1': [file4],  # Does not appear in result
@@ -277,9 +287,12 @@
         'file4': [file4],  # Does not appear in result
         }))
     self.assertEqual(
-        [('FILENAME.EXT', 'Abort, Retry, or Fail?',
-          'application/octet-stream')],
-        attachments)
+        [
+            (
+                'FILENAME.EXT', b'Abort, Retry, or Fail?',
+                'application/octet-stream')
+        ], attachments)
+    file3.seek(0)
 
   def testParseIssueRequestKeptAttachments(self):
     pass  # TODO(jrobbins): Write this test.
@@ -368,12 +381,12 @@
     self.assertEqual('', parsed_users.owner_username)
     self.assertEqual(
         framework_constants.NO_USER_SPECIFIED, parsed_users.owner_id)
-    self.assertItemsEqual(['c@example.com', 'a@example.com'],
-                          parsed_users.cc_usernames)
+    six.assertCountEqual(
+        self, ['c@example.com', 'a@example.com'], parsed_users.cc_usernames)
     self.assertEqual(['b@example.com'], parsed_users.cc_usernames_remove)
-    self.assertItemsEqual([TEST_ID_MAP['c@example.com'],
-                           TEST_ID_MAP['a@example.com']],
-                          parsed_users.cc_ids)
+    six.assertCountEqual(
+        self, [TEST_ID_MAP['c@example.com'], TEST_ID_MAP['a@example.com']],
+        parsed_users.cc_ids)
     self.assertEqual([TEST_ID_MAP['b@example.com']],
                       parsed_users.cc_ids_remove)
 
@@ -386,11 +399,12 @@
     self.assertEqual('fuhqwhgads@example.com', parsed_users.owner_username)
     gen_uid = framework_helpers.MurmurHash3_x86_32(parsed_users.owner_username)
     self.assertEqual(gen_uid, parsed_users.owner_id)  # autocreated user
-    self.assertItemsEqual(
-        ['c@example.com', 'fuhqwhgads@example.com'], parsed_users.cc_usernames)
+    six.assertCountEqual(
+        self, ['c@example.com', 'fuhqwhgads@example.com'],
+        parsed_users.cc_usernames)
     self.assertEqual([], parsed_users.cc_usernames_remove)
-    self.assertItemsEqual(
-       [TEST_ID_MAP['c@example.com'], gen_uid], parsed_users.cc_ids)
+    six.assertCountEqual(
+        self, [TEST_ID_MAP['c@example.com'], gen_uid], parsed_users.cc_ids)
     self.assertEqual([], parsed_users.cc_ids_remove)
 
     post_data = fake.PostData({
@@ -398,12 +412,12 @@
         })
     parsed_users = tracker_helpers._ParseIssueRequestUsers(
         'fake connection', post_data, self.services)
-    self.assertItemsEqual(
-        ['c@example.com', 'b@example.com'], parsed_users.cc_usernames)
+    six.assertCountEqual(
+        self, ['c@example.com', 'b@example.com'], parsed_users.cc_usernames)
     self.assertEqual([], parsed_users.cc_usernames_remove)
-    self.assertItemsEqual(
-       [TEST_ID_MAP['c@example.com'], TEST_ID_MAP['b@example.com']],
-       parsed_users.cc_ids)
+    six.assertCountEqual(
+        self, [TEST_ID_MAP['c@example.com'], TEST_ID_MAP['b@example.com']],
+        parsed_users.cc_ids)
     self.assertEqual([], parsed_users.cc_ids_remove)
 
   def testParseBlockers_BlockedOnNothing(self):
@@ -698,9 +712,9 @@
   @mock.patch('tracker.tracker_constants.ISSUE_ATTACHMENTS_QUOTA_HARD', 1)
   def testComputeNewQuotaBytesUsed_ProjectQuota(self):
     upload_1 = framework_helpers.AttachmentUpload(
-        'matter not', 'three men make a tiger', 'matter not')
+        'matter not', b'three men make a tiger', 'matter not')
     upload_2 = framework_helpers.AttachmentUpload(
-        'matter not', 'chicken', 'matter not')
+        'matter not', b'chicken', 'matter not')
     attachments = [upload_1, upload_2]
 
     project = fake.Project()
@@ -713,7 +727,7 @@
     self.assertEqual(actual_new, expected_new)
 
     upload_3 = framework_helpers.AttachmentUpload(
-        'matter not', 'donut', 'matter not')
+        'matter not', b'donut', 'matter not')
     attachments.append(upload_3)
     with self.assertRaises(exceptions.OverAttachmentQuota):
       tracker_helpers.ComputeNewQuotaBytesUsed(project, attachments)
@@ -722,7 +736,7 @@
       'tracker.tracker_constants.ISSUE_ATTACHMENTS_QUOTA_HARD', len('tiger'))
   def testComputeNewQuotaBytesUsed_GeneralQuota(self):
     upload_1 = framework_helpers.AttachmentUpload(
-        'matter not', 'tiger', 'matter not')
+        'matter not', b'tiger', 'matter not')
     attachments = [upload_1]
 
     project = fake.Project()
@@ -732,13 +746,13 @@
     self.assertEqual(actual_new, expected_new)
 
     upload_2 = framework_helpers.AttachmentUpload(
-        'matter not', 'donut', 'matter not')
+        'matter not', b'donut', 'matter not')
     attachments.append(upload_2)
     with self.assertRaises(exceptions.OverAttachmentQuota):
       tracker_helpers.ComputeNewQuotaBytesUsed(project, attachments)
 
     upload_3 = framework_helpers.AttachmentUpload(
-        'matter not', 'donut', 'matter not')
+        'matter not', b'donut', 'matter not')
     attachments.append(upload_3)
     with self.assertRaises(exceptions.OverAttachmentQuota):
       tracker_helpers.ComputeNewQuotaBytesUsed(project, attachments)
@@ -901,7 +915,7 @@
 
   # ParseMergeFields is tested in IssueMergeTest.
   # AddIssueStarrers is tested in IssueMergeTest.testMergeIssueStars().
-  # IsMergeAllowed is tested in IssueMergeTest.
+  # CanEditProjectIssue is tested in IssueMergeTest.
 
   def testPairDerivedValuesWithRuleExplanations_Nothing(self):
     """Test we return nothing for an issue with no derived values."""
@@ -990,8 +1004,9 @@
     issue_list = [self.issue1, self.issue2, self.issue3]
     users_by_id = tracker_helpers.MakeViewsForUsersInIssues(
         'fake cnxn', issue_list, self.user)
-    self.assertItemsEqual([0, 1, 1001, 1002, 1003, 2001, 2002, 3002],
-                          list(users_by_id.keys()))
+    six.assertCountEqual(
+        self, [0, 1, 1001, 1002, 1003, 2001, 2002, 3002],
+        list(users_by_id.keys()))
     for user_id in [1001, 1002, 1003, 2001]:
       self.assertEqual(users_by_id[user_id].user_id, user_id)
 
@@ -999,8 +1014,8 @@
     issue_list = [self.issue1, self.issue2, self.issue3]
     users_by_id = tracker_helpers.MakeViewsForUsersInIssues(
         'fake cnxn', issue_list, self.user, omit_ids=[1001, 1003])
-    self.assertItemsEqual([0, 1, 1002, 2001, 2002, 3002],
-        list(users_by_id.keys()))
+    six.assertCountEqual(
+        self, [0, 1, 1002, 2001, 2002, 3002], list(users_by_id.keys()))
     for user_id in [1002, 2001, 2002, 3002]:
       self.assertEqual(users_by_id[user_id].user_id, user_id)
 
@@ -1008,7 +1023,7 @@
     issue_list = []
     users_by_id = tracker_helpers.MakeViewsForUsersInIssues(
         'fake cnxn', issue_list, self.user)
-    self.assertItemsEqual([], list(users_by_id.keys()))
+    six.assertCountEqual(self, [], list(users_by_id.keys()))
 
 
 class GetAllIssueProjectsTest(unittest.TestCase):
@@ -1236,19 +1251,34 @@
     self.assertEqual(str(mergee_issue.local_id), text)
     self.assertEqual(mergee_issue, merge_into_issue)
 
-  def testIsMergeAllowed(self):
+  def testCanEditProjectIssue(self):
     mr = testing_helpers.MakeMonorailRequest()
-    issue = fake.MakeTestIssue(987, 1, 'summary', 'New', 111)
+    issue = fake.MakeTestIssue(
+        self.project.project_id, 1, 'summary', 'New', 111)
     issue.project_name = self.project.project_name
 
-    for (perm_set, expected_merge_allowed) in (
-            (permissions.READ_ONLY_PERMISSIONSET, False),
-            (permissions.COMMITTER_INACTIVE_PERMISSIONSET, False),
-            (permissions.COMMITTER_ACTIVE_PERMISSIONSET, True),
-            (permissions.OWNER_ACTIVE_PERMISSIONSET, True)):
-      mr.perms = perm_set
-      merge_allowed = tracker_helpers.IsMergeAllowed(issue, mr, self.services)
-      self.assertEqual(expected_merge_allowed, merge_allowed)
+    non_member_not_allowed = tracker_helpers.CanEditProjectIssue(
+        mr, self.project, issue, None)
+    self.assertEqual(False, non_member_not_allowed)
+
+    committer_id = 3
+    self.project.committer_ids.extend([committer_id])
+    mr.auth.effective_ids.add(committer_id)
+    committer_allowed = tracker_helpers.CanEditProjectIssue(
+        mr, self.project, issue, None)
+    self.assertEqual(True, committer_allowed)
+
+    self.project.state = project_pb2.ProjectState.ARCHIVED
+    committer_read_only_not_allowed = tracker_helpers.CanEditProjectIssue(
+        mr, self.project, issue, None)
+    self.assertEqual(False, committer_read_only_not_allowed)
+
+    owner_id = 1
+    self.project.owner_ids.extend([owner_id])
+    mr.auth.effective_ids.add(owner_id)
+    owner_read_only_not_allowed = tracker_helpers.CanEditProjectIssue(
+        mr, self.project, issue, None)
+    self.assertEqual(False, owner_read_only_not_allowed)
 
   def testMergeIssueStars(self):
     mr = testing_helpers.MakeMonorailRequest()
@@ -1276,13 +1306,13 @@
 
     new_starrers = tracker_helpers.GetNewIssueStarrers(
         self.cnxn, self.services, [1, 3], 2)
-    self.assertItemsEqual(new_starrers, [1, 2, 6])
+    six.assertCountEqual(self, new_starrers, [1, 2, 6])
     tracker_helpers.AddIssueStarrers(
         self.cnxn, self.services, mr, 2, self.project, new_starrers)
     issue_2_starrers = self.services.issue_star.LookupItemStarrers(
         self.cnxn, 2)
     # XXX(jrobbins): these tests incorrectly mix local IDs with IIDs.
-    self.assertItemsEqual([1, 2, 3, 4, 5, 6], issue_2_starrers)
+    six.assertCountEqual(self, [1, 2, 3, 4, 5, 6], issue_2_starrers)
 
 
 class MergeLinkedMembersTest(unittest.TestCase):
@@ -1345,58 +1375,61 @@
   def testUnsignedUser_NormalProject(self):
     visible_members = self.DoFiltering(
         permissions.READ_ONLY_PERMISSIONSET, unsigned_user=True)
-    self.assertItemsEqual(
-        [self.owner_email, self.committer_email, self.contributor_email,
-         self.indirect_member_email],
-        visible_members)
+    six.assertCountEqual(
+        self, [
+            self.owner_email, self.committer_email, self.contributor_email,
+            self.indirect_member_email
+        ], visible_members)
 
   def testUnsignedUser_RestrictedProject(self):
     self.project.only_owners_see_contributors = True
     visible_members = self.DoFiltering(
         permissions.READ_ONLY_PERMISSIONSET, unsigned_user=True)
-    self.assertItemsEqual(
+    six.assertCountEqual(
+        self,
         [self.owner_email, self.committer_email, self.indirect_member_email],
         visible_members)
 
   def testOwnersAndAdminsCanSeeAll_NormalProject(self):
     visible_members = self.DoFiltering(
         permissions.OWNER_ACTIVE_PERMISSIONSET)
-    self.assertItemsEqual(self.all_emails, visible_members)
+    six.assertCountEqual(self, self.all_emails, visible_members)
 
     visible_members = self.DoFiltering(
         permissions.ADMIN_PERMISSIONSET)
-    self.assertItemsEqual(self.all_emails, visible_members)
+    six.assertCountEqual(self, self.all_emails, visible_members)
 
   def testOwnersAndAdminsCanSeeAll_HubAndSpoke(self):
     self.project.only_owners_see_contributors = True
 
     visible_members = self.DoFiltering(
         permissions.OWNER_ACTIVE_PERMISSIONSET)
-    self.assertItemsEqual(self.all_emails, visible_members)
+    six.assertCountEqual(self, self.all_emails, visible_members)
 
     visible_members = self.DoFiltering(
         permissions.ADMIN_PERMISSIONSET)
-    self.assertItemsEqual(self.all_emails, visible_members)
+    six.assertCountEqual(self, self.all_emails, visible_members)
 
     visible_members = self.DoFiltering(
         permissions.COMMITTER_ACTIVE_PERMISSIONSET)
-    self.assertItemsEqual(self.all_emails, visible_members)
+    six.assertCountEqual(self, self.all_emails, visible_members)
 
   def testNonOwnersCanSeeAll_NormalProject(self):
     visible_members = self.DoFiltering(
         permissions.COMMITTER_ACTIVE_PERMISSIONSET)
-    self.assertItemsEqual(self.all_emails, visible_members)
+    six.assertCountEqual(self, self.all_emails, visible_members)
 
     visible_members = self.DoFiltering(
         permissions.CONTRIBUTOR_ACTIVE_PERMISSIONSET)
-    self.assertItemsEqual(self.all_emails, visible_members)
+    six.assertCountEqual(self, self.all_emails, visible_members)
 
   def testCommittersSeeOnlySameDomain_HubAndSpoke(self):
     self.project.only_owners_see_contributors = True
 
     visible_members = self.DoFiltering(
         permissions.CONTRIBUTOR_ACTIVE_PERMISSIONSET)
-    self.assertItemsEqual(
+    six.assertCountEqual(
+        self,
         [self.owner_email, self.committer_email, self.indirect_member_email],
         visible_members)
 
@@ -1618,29 +1651,44 @@
     tracker_helpers.AssertValidIssueForCreate(
         self.cnxn, self.services, input_issue, 'nonempty description')
 
+  def testAssertValidIssueForCreate_ValidatesLabels(self):
+    input_issue = tracker_pb2.Issue(
+        summary='sum',
+        labels=['freeze_new_label'],
+        status='New',
+        owner_id=111,
+        project_id=789)
+    with self.assertRaisesRegex(
+        exceptions.InputException,
+        ("The creation of new labels is blocked for the Chromium project"
+         " in Monorail. To continue with editing your issue, please"
+         " remove: freeze_new_label label\\(s\\)")):
+      tracker_helpers.AssertValidIssueForCreate(
+          self.cnxn, self.services, input_issue, 'nonempty description')
+
   def testAssertValidIssueForCreate_ValidatesOwner(self):
     input_issue = tracker_pb2.Issue(
         summary='sum', status='New', owner_id=222, project_id=789)
-    with self.assertRaisesRegexp(exceptions.InputException,
-                                 'Issue owner must be a project member'):
+    with self.assertRaisesRegex(exceptions.InputException,
+                                'Issue owner must be a project member'):
       tracker_helpers.AssertValidIssueForCreate(
           self.cnxn, self.services, input_issue, 'nonempty description')
     input_issue.owner_id = 333
-    with self.assertRaisesRegexp(exceptions.InputException,
-                                 'Issue owner user ID not found'):
+    with self.assertRaisesRegex(exceptions.InputException,
+                                'Issue owner user ID not found'):
       tracker_helpers.AssertValidIssueForCreate(
           self.cnxn, self.services, input_issue, 'nonempty description')
     input_issue.owner_id = 999
-    with self.assertRaisesRegexp(exceptions.InputException,
-                                 'Issue owner cannot be a user group'):
+    with self.assertRaisesRegex(exceptions.InputException,
+                                'Issue owner cannot be a user group'):
       tracker_helpers.AssertValidIssueForCreate(
           self.cnxn, self.services, input_issue, 'nonempty description')
 
   def testAssertValidIssueForCreate_ValidatesSummary(self):
     input_issue = tracker_pb2.Issue(
         summary='', status='New', owner_id=111, project_id=789)
-    with self.assertRaisesRegexp(exceptions.InputException,
-                                 'Summary is required'):
+    with self.assertRaisesRegex(exceptions.InputException,
+                                'Summary is required'):
       tracker_helpers.AssertValidIssueForCreate(
           self.cnxn, self.services, input_issue, 'nonempty description')
       input_issue.summary = '   '
@@ -1650,8 +1698,8 @@
   def testAssertValidIssueForCreate_ValidatesDescription(self):
     input_issue = tracker_pb2.Issue(
         summary='sum', status='New', owner_id=111, project_id=789)
-    with self.assertRaisesRegexp(exceptions.InputException,
-                                 'Description is required'):
+    with self.assertRaisesRegex(exceptions.InputException,
+                                'Description is required'):
       tracker_helpers.AssertValidIssueForCreate(
           self.cnxn, self.services, input_issue, '')
       tracker_helpers.AssertValidIssueForCreate(
@@ -1678,8 +1726,8 @@
       return None
 
     self.services.config.LookupStatusID = mock_status_lookup
-    with self.assertRaisesRegexp(exceptions.InputException,
-                                 'Undefined status: DNE_status'):
+    with self.assertRaisesRegex(exceptions.InputException,
+                                'Undefined status: DNE_status'):
       tracker_helpers.AssertValidIssueForCreate(
           self.cnxn, self.services, input_issue, 'nonempty description')
 
@@ -1691,9 +1739,8 @@
         owner_id=111,
         project_id=789,
         component_ids=[3])
-    with self.assertRaisesRegexp(
-        exceptions.InputException,
-        'Undefined or deprecated component with id: 3'):
+    with self.assertRaisesRegex(exceptions.InputException,
+                                'Undefined or deprecated component with id: 3'):
       tracker_helpers.AssertValidIssueForCreate(
           self.cnxn, self.services, input_issue, 'nonempty description')
 
@@ -1704,9 +1751,8 @@
         owner_id=111,
         project_id=789,
         component_ids=[self.component_def_2.component_id])
-    with self.assertRaisesRegexp(
-        exceptions.InputException,
-        'Undefined or deprecated component with id: 2'):
+    with self.assertRaisesRegex(exceptions.InputException,
+                                'Undefined or deprecated component with id: 2'):
       tracker_helpers.AssertValidIssueForCreate(
           self.cnxn, self.services, input_issue, 'nonempty description')
 
@@ -1728,8 +1774,8 @@
                 user_fd.field_id, None, None, 124, None, None, False)
         ])
     copied_issue = copy.deepcopy(input_issue)
-    with self.assertRaisesRegexp(exceptions.InputException,
-                                 r'users/123: .+\nusers/124: .+'):
+    with self.assertRaisesRegex(exceptions.InputException,
+                                r'users/123: .+\nusers/124: .+'):
       tracker_helpers.AssertValidIssueForCreate(
           self.cnxn, self.services, input_issue, 'nonempty description')
     self.assertEqual(input_issue, copied_issue)
@@ -1894,7 +1940,7 @@
     expected_merge_add = copy.deepcopy(merge_add)
     expected_merge_add.assume_stale = False
     # We are adding 333 and removing 222 in issue_main with delta_main.
-    expected_merge_add.cc_ids = [expected_main.owner_id, 333, 111]
+    expected_merge_add.cc_ids = sorted([expected_main.owner_id, 111, 333])
     expected_merged_from_add[expected_merge_add.issue_id] = [
         issue_main.issue_id
     ]
@@ -2086,9 +2132,9 @@
     ]
 
     upload_1 = framework_helpers.AttachmentUpload(
-        'dragon', 'OOOOOO\n', 'text/plain')
+        'dragon', b'OOOOOO\n', 'text/plain')
     upload_2 = framework_helpers.AttachmentUpload(
-        'snake', 'ooooo\n', 'text/plain')
+        'snake', b'ooooo\n', 'text/plain')
     attachment_uploads = [upload_1, upload_2]
 
     actual = tracker_helpers._EnforceAttachmentQuotaLimits(
@@ -2118,13 +2164,13 @@
     ]
 
     upload_1 = framework_helpers.AttachmentUpload(
-        'dragon', 'OOOOOO\n', 'text/plain')
+        'dragon', b'OOOOOO\n', 'text/plain')
     upload_2 = framework_helpers.AttachmentUpload(
-        'snake', 'ooooo\n', 'text/plain')
+        'snake', b'ooooo\n', 'text/plain')
     attachment_uploads = [upload_1, upload_2]
 
-    with self.assertRaisesRegexp(exceptions.OverAttachmentQuota,
-                                 r'.+ project Patroclus\n.+ project Circe'):
+    with self.assertRaisesRegex(exceptions.OverAttachmentQuota,
+                                r'.+ project Patroclus\n.+ project Circe'):
       tracker_helpers._EnforceAttachmentQuotaLimits(
           self.cnxn, issue_delta_pairs, self.services, attachment_uploads)
 
@@ -2225,6 +2271,21 @@
             delta_8, delta_9, delta_10, delta_11
         ])
 
+  def testAssertIssueChangesValid_ValidatesLabels(self):
+    """Asserts labels."""
+    issue_1 = _Issue('chicken', 1)
+    self.services.issue.TestAddIssue(issue_1)
+    delta_1 = tracker_pb2.IssueDelta(labels_add=['freeze_new_label'])
+    issue_delta_pairs = [(issue_1, delta_1)]
+    comment = 'just a plain comment'
+    with self.assertRaisesRegex(
+        exceptions.InputException,
+        ("The creation of new labels is blocked for the Chromium project"
+         " in Monorail. To continue with editing your issue, please"
+         " remove: freeze_new_label label\\(s\\).")):
+      tracker_helpers._AssertIssueChangesValid(
+          self.cnxn, issue_delta_pairs, self.services, comment_content=comment)
+
   def testAssertIssueChangesValid_RequiredField(self):
     """Asserts fields and requried fields.."""
     issue_1 = _Issue('chicken', 1)
@@ -2323,8 +2384,8 @@
         '%s: MERGED type statuses must accompany mergedInto values.' %
         issue_3_ref)
 
-    with self.assertRaisesRegexp(exceptions.InputException,
-                                 '\n'.join(expected_err_msgs)):
+    with self.assertRaisesRegex(exceptions.InputException,
+                                '\n'.join(expected_err_msgs)):
       tracker_helpers._AssertIssueChangesValid(
           self.cnxn, issue_delta_pairs, self.services, comment_content=comment)
 
@@ -2390,8 +2451,8 @@
         (issue_7, delta_7),
     ]
 
-    with self.assertRaisesRegexp(exceptions.InputException,
-                                 '\n'.join(expected_err_msgs)):
+    with self.assertRaisesRegex(exceptions.InputException,
+                                '\n'.join(expected_err_msgs)):
       tracker_helpers._AssertIssueChangesValid(
           self.cnxn, issue_delta_pairs, self.services)
 
@@ -2426,13 +2487,13 @@
 
     new_cc_ids = tracker_helpers._ComputeNewCcsFromIssueMerge(
         target_issue, [source_issue_1, source_issue_2, source_issue_3])
-    self.assertItemsEqual(new_cc_ids, [444, 555, 222])
+    six.assertCountEqual(self, new_cc_ids, [444, 555, 222])
 
   def testComputeNewCcsFromIssueMerge_Empty(self):
     target_issue = fake.MakeTestIssue(789, 10, 'Target issue', 'New', 111)
     self.services.issue.TestAddIssue(target_issue)
     new_cc_ids = tracker_helpers._ComputeNewCcsFromIssueMerge(target_issue, [])
-    self.assertItemsEqual(new_cc_ids, [])
+    six.assertCountEqual(self, new_cc_ids, [])
 
   def testEnforceNonMergeStatusDeltas(self):
     # No updates: user is setting to a non-MERGED status with no
@@ -2692,7 +2753,7 @@
             [('proj', m_remove.local_id)], default_project_name='proj')
         ]
     self.assertEqual(actual_amendments, expected_amendments)
-    self.assertItemsEqual(actual_new_starrers, [333, 444])
+    six.assertCountEqual(self, actual_new_starrers, [333, 444])
 
     expected_issue.cc_ids.append(777)
     expected_issue.blocked_on_iids = [78404, bo_add.issue_id]
@@ -2767,7 +2828,7 @@
     dne_users = [2, 3]
     existing = [1, 1001, 1002, 1003, 2001, 2002, 3002]
     all_users = existing + dne_users
-    with self.assertRaisesRegexp(
+    with self.assertRaisesRegex(
         exceptions.InputException,
         'users/2: User does not exist.\nusers/3: User does not exist.'):
       with exceptions.ErrorAggregator(exceptions.InputException) as err_agg:
diff --git a/tracker/test/tracker_views_test.py b/tracker/test/tracker_views_test.py
index ddc2a3e..db047c3 100644
--- a/tracker/test/tracker_views_test.py
+++ b/tracker/test/tracker_views_test.py
@@ -1,7 +1,6 @@
-# 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.
 
 """Unittest for issue tracker views."""
 from __future__ import print_function
@@ -23,8 +22,8 @@
 from framework import gcs_helpers
 from framework import template_helpers
 from framework import urls
-from proto import project_pb2
-from proto import tracker_pb2
+from mrproto import project_pb2
+from mrproto import tracker_pb2
 from services import service_manager
 from testing import fake
 from testing import testing_helpers
diff --git a/tracker/test/webcomponentspage_test.py b/tracker/test/webcomponentspage_test.py
index 65cfc66..86d3606 100644
--- a/tracker/test/webcomponentspage_test.py
+++ b/tracker/test/webcomponentspage_test.py
@@ -1,7 +1,6 @@
-# Copyright 2020 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 2020 The Chromium Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
 """Tests for the Monorail SPA pages, as served by EZT."""
 from __future__ import print_function
 from __future__ import division
@@ -10,12 +9,9 @@
 import mock
 import unittest
 
-import ezt
 
-import settings
-from framework import permissions
-from proto import project_pb2
-from proto import site_pb2
+from framework import exceptions
+from mrproto import project_pb2
 from services import service_manager
 from tracker import webcomponentspage
 from testing import fake
@@ -35,8 +31,7 @@
     self.hotlist = self.services.features.TestAddHotlist(
         'HotlistName', summary='summary', owner_ids=[111], hotlist_id=1236)
 
-    self.servlet = webcomponentspage.WebComponentsPage(
-        'req', 'res', services=self.services)
+    self.servlet = webcomponentspage.WebComponentsPage(services=self.services)
 
   def testHotlistPage_OldUiUrl(self):
     mr = testing_helpers.MakeMonorailRequest(
@@ -76,8 +71,7 @@
     self.project_a = self.services.project.TestAddProject('a', project_id=1)
     self.project_b = self.services.project.TestAddProject('b', project_id=2)
 
-    self.servlet = webcomponentspage.ProjectListPage(
-        'req', 'res', services=self.services)
+    self.servlet = webcomponentspage.ProjectListPage(services=self.services)
 
   @mock.patch('settings.domain_to_default_project', {})
   def testMaybeRedirectToDomainDefaultProject_NoMatch(self):
@@ -114,7 +108,6 @@
     mr = testing_helpers.MakeMonorailRequest()
     mr.request.host = 'example.com'
     self.servlet.redirect = mock.Mock()
-    msg = self.servlet._MaybeRedirectToDomainDefaultProject(mr)
-    print('msg: ' + msg)
-    self.assertTrue(msg.startswith('Redirected'))
-    self.servlet.redirect.assert_called_once()
+    with self.assertRaises(exceptions.RedirectException) as e:
+      self.servlet._MaybeRedirectToDomainDefaultProject(mr)
+    self.assertIn('/p/a', str(e.exception))