Merge branch 'main' into avm99963-monorail

Merged commit 34d8229ae2b51fb1a15bd208e6fe6185c94f6266

GitOrigin-RevId: 7ee0917f93a577e475f8e09526dd144d245593f4
diff --git a/sitewide/test/userprofile_test.py b/sitewide/test/userprofile_test.py
index b4e29d8..42c901e 100644
--- a/sitewide/test/userprofile_test.py
+++ b/sitewide/test/userprofile_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 user profile page."""
 from __future__ import print_function
@@ -10,21 +9,18 @@
 
 import mock
 import unittest
-import logging
-import webapp2
 import ezt
+import six
 
-from framework import framework_helpers
+from google.appengine.ext import testbed
+import pytest
+
 from framework import framework_views
 from framework import permissions
-from proto import project_pb2
-from proto import user_pb2
+from mrproto import project_pb2
 from services import service_manager
 from sitewide import userprofile
 from testing import fake
-from testing import testing_helpers
-
-from google.appengine.ext import testbed
 
 REGULAR_USER_ID = 111
 ADMIN_USER_ID = 222
@@ -48,8 +44,7 @@
   mr.viewed_user_auth.effective_ids = {viewed_user_id}
   mr.viewed_user_auth.user_view = framework_views.UserView(viewed_user_pb)
   mr.viewed_user_name = viewed_user_name
-  mr.request = webapp2.Request.blank("/")
-  mr.request_path = mr.request.path
+  mr.request_path = '/'
   return mr
 
 
@@ -67,7 +62,7 @@
         usergroup=fake.UserGroupService(),
         project_star=fake.ProjectStarService(),
         user_star=fake.UserStarService())
-    self.servlet = userprofile.UserProfile('req', 'res', services=services)
+    self.servlet = userprofile.UserProfile(services=services)
 
     for user_id in (
         REGULAR_USER_ID, ADMIN_USER_ID, OTHER_USER_ID):
@@ -111,7 +106,7 @@
   def assertProjectsAnyOrder(self, value_to_test, *expected_project_names):
     actual_project_names = [project_view.project_name
                             for project_view in value_to_test]
-    self.assertItemsEqual(expected_project_names, actual_project_names)
+    six.assertCountEqual(self, expected_project_names, actual_project_names)
 
   def testGatherPageData_RegularUserViewingOtherUserProjects(self):
     """A user can see the other users' live projects, but not archived ones."""
@@ -125,13 +120,15 @@
                                 'other-owner-live')
     self.assertProjectsAnyOrder(page_data['committer_of_projects'],
                                 'other-member-live')
-    self.assertFalse(page_data['owner_of_archived_projects'])
+    self.assertProjectsAnyOrder(
+        page_data['owner_of_archived_projects'], 'other-owner-archived')
     self.assertEqual('ot...@xyz.com', page_data['viewed_user_display_name'])
     self.assertEqual(ezt.boolean(False), page_data['can_delete_user'])
     self.mock_guspd.assert_called_once_with(
         111, mr.viewed_user_auth.user_view, mr.viewed_user_auth.user_pb,
         None)
 
+  @pytest.mark.skip(reason='Test is flaky (https://crbug.com/monorail/12052)')
   def testGatherPageData_RegularUserViewingOwnProjects(self):
     """A user can see all their own projects: live or archived."""
     mr = MakeReqInfo(