Merge branch 'main' into avm99963-monorail

Merged commit 34d8229ae2b51fb1a15bd208e6fe6185c94f6266

GitOrigin-RevId: 7ee0917f93a577e475f8e09526dd144d245593f4
diff --git a/services/test/features_svc_test.py b/services/test/features_svc_test.py
index d285152..fcd0546 100644
--- a/services/test/features_svc_test.py
+++ b/services/test/features_svc_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 features_svc module."""
 from __future__ import print_function
@@ -13,6 +12,7 @@
   from mox3 import mox
 except ImportError:
   import mox
+import six
 import time
 import unittest
 import mock
@@ -27,8 +27,8 @@
 from framework import exceptions
 from framework import framework_constants
 from framework import sql
-from proto import tracker_pb2
-from proto import features_pb2
+from mrproto import tracker_pb2
+from mrproto import features_pb2
 from services import chart_svc
 from services import features_svc
 from services import star_svc
@@ -82,14 +82,14 @@
     hotlist_dict = self.features_service.hotlist_2lc._DeserializeHotlists(
         hotlist_rows, issue_rows, role_rows)
 
-    self.assertItemsEqual([123, 234], list(hotlist_dict.keys()))
+    six.assertCountEqual(self, [123, 234], list(hotlist_dict.keys()))
     self.assertEqual(123, hotlist_dict[123].hotlist_id)
     self.assertEqual('hot1', hotlist_dict[123].name)
-    self.assertItemsEqual([111, 444], hotlist_dict[123].owner_ids)
-    self.assertItemsEqual([222], hotlist_dict[123].editor_ids)
-    self.assertItemsEqual([333], hotlist_dict[123].follower_ids)
+    six.assertCountEqual(self, [111, 444], hotlist_dict[123].owner_ids)
+    six.assertCountEqual(self, [222], hotlist_dict[123].editor_ids)
+    six.assertCountEqual(self, [333], hotlist_dict[123].follower_ids)
     self.assertEqual(234, hotlist_dict[234].hotlist_id)
-    self.assertItemsEqual([111], hotlist_dict[234].owner_ids)
+    six.assertCountEqual(self, [111], hotlist_dict[234].owner_ids)
 
 
 class HotlistIDTwoLevelCache(unittest.TestCase):
@@ -138,12 +138,12 @@
 
     # Assertions
     self.features_service.hotlist2user_tbl.Select.assert_called_once_with(
-        self.cnxn, cols=['hotlist_id', 'user_id'], user_id=[555, 333, 222],
+        self.cnxn, cols=['hotlist_id', 'user_id'], user_id=[222, 333, 555],
         role_name='owner')
     hotlist_ids = [123, 124, 125, 126, 127]
     self.features_service.hotlist_tbl.Select.assert_called_once_with(
         self.cnxn, cols=['id', 'name'], id=hotlist_ids, is_deleted=False,
-        where=[('LOWER(name) IN (%s,%s)', ['name3', 'name1'])])
+        where=[('LOWER(name) IN (%s,%s)', ['name1', 'name3'])])
 
     self.assertEqual(hit,{
         ('name1', 111): 121,
@@ -635,7 +635,7 @@
         17: [tracker_pb2.FilterRule(
             predicate=rows[3][2], add_cc_ids=[111, 222])],
     }
-    self.assertItemsEqual(rules_dict, expected_dict)
+    six.assertCountEqual(self, rules_dict, expected_dict)
 
     self.features_service.filterrule_tbl.Select.assert_called_once_with(
         self.cnxn, features_svc.FILTERRULE_COLS)
@@ -667,7 +667,7 @@
     emails = {'cow@fart.test': 222}
     rules_dict = self.features_service.ExpungeFilterRulesByUser(
         self.cnxn, emails)
-    self.assertItemsEqual(rules_dict, {})
+    six.assertCountEqual(self, rules_dict, {})
 
     self.features_service.filterrule_tbl.Select.assert_called_once_with(
         self.cnxn, features_svc.FILTERRULE_COLS)
@@ -773,7 +773,7 @@
         self.cnxn, ['q3-todo', 'Q4-TODO'], [222, 333, 444])
     self.assertEqual(ret, {('q3-todo', 222) : 123, ('q4-todo', 333): 124})
     self.features_service.hotlist2user_tbl.Select.assert_called_once_with(
-        self.cnxn, cols=['hotlist_id', 'user_id'], user_id=[444, 333, 222],
+        self.cnxn, cols=['hotlist_id', 'user_id'], user_id=[222, 333, 444],
         role_name='owner')
     self.features_service.hotlist_tbl.Select.assert_called_once_with(
         self.cnxn, cols=['id', 'name'], id=[123, 125], is_deleted=False,
@@ -965,7 +965,7 @@
     hotlist_dict = self.features_service.GetHotlists(
         self.cnxn, [123, 456])
     self.mox.VerifyAll()
-    self.assertItemsEqual([123, 456], list(hotlist_dict.keys()))
+    six.assertCountEqual(self, [123, 456], list(hotlist_dict.keys()))
     self.assertEqual('hotlist1', hotlist_dict[123].name)
     self.assertEqual('hotlist2', hotlist_dict[456].name)
 
@@ -1306,7 +1306,7 @@
     self.features_service.GetProjectIDsFromHotlist = mock.Mock(
         return_value=[hotlists_project_id])
 
-    hotlist_ids = hotlists_by_id.keys()
+    hotlist_ids = list(hotlists_by_id.keys())
     commit = True  # commit in ExpungeHotlists should be True by default.
     self.features_service.ExpungeHotlists(
         self.cnxn, hotlist_ids, star_service, user_service, chart_service)