Merge branch 'main' into avm99963-monorail
Merged commit 34d8229ae2b51fb1a15bd208e6fe6185c94f6266
GitOrigin-RevId: 7ee0917f93a577e475f8e09526dd144d245593f4
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):