From: Jacob Lifshay Date: Mon, 14 Sep 2020 22:00:54 +0000 (-0700) Subject: add summary to MockBug X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=629184e16a83ff54b4669195496534a9922d6f4f;p=utils.git add summary to MockBug --- diff --git a/src/budget_sync/test/mock_bug.py b/src/budget_sync/test/mock_bug.py index 39a681d..acc2cae 100644 --- a/src/budget_sync/test/mock_bug.py +++ b/src/budget_sync/test/mock_bug.py @@ -8,7 +8,8 @@ class MockBug: cf_budget: str, cf_total_budget: str, cf_nlnet_milestone: Optional[str], - cf_payees_list: str): + cf_payees_list: str, + summary: str): self.id = bug_id if cf_budget_parent is not None: self.cf_budget_parent = cf_budget_parent @@ -18,6 +19,7 @@ class MockBug: cf_nlnet_milestone = "---" self.cf_nlnet_milestone = cf_nlnet_milestone self.cf_payees_list = cf_payees_list + self.summary = summary def __repr__(self): cf_budget_parent = getattr(self, "cf_budget_parent", None) @@ -26,4 +28,5 @@ class MockBug: f"cf_budget={self.cf_budget!r}, " f"cf_total_budget={self.cf_total_budget!r}, " f"cf_nlnet_milestone={self.cf_nlnet_milestone!r}, " - f"cf_payees_list={self.cf_payees_list!r})") + f"cf_payees_list={self.cf_payees_list!r}, " + f"summary={self.summary!r})") diff --git a/src/budget_sync/test/test_budget_graph.py b/src/budget_sync/test/test_budget_graph.py index a8857cb..9fe072a 100644 --- a/src/budget_sync/test/test_budget_graph.py +++ b/src/budget_sync/test/test_budget_graph.py @@ -93,37 +93,43 @@ EXAMPLE_BUG1 = MockBug(bug_id=1, cf_budget="0", cf_total_budget="0", cf_nlnet_milestone=None, - cf_payees_list="") + cf_payees_list="", + summary="") EXAMPLE_LOOP1_BUG1 = MockBug(bug_id=1, cf_budget_parent=1, cf_budget="0", cf_total_budget="0", cf_nlnet_milestone=None, - cf_payees_list="") + cf_payees_list="", + summary="") EXAMPLE_LOOP2_BUG1 = MockBug(bug_id=1, cf_budget_parent=2, cf_budget="0", cf_total_budget="0", cf_nlnet_milestone=None, - cf_payees_list="") + cf_payees_list="", + summary="") EXAMPLE_LOOP2_BUG2 = MockBug(bug_id=2, cf_budget_parent=1, cf_budget="0", cf_total_budget="0", cf_nlnet_milestone=None, - cf_payees_list="") + cf_payees_list="", + summary="") EXAMPLE_PARENT_BUG1 = MockBug(bug_id=1, cf_budget_parent=None, cf_budget="10", cf_total_budget="20", cf_nlnet_milestone="milestone 1", - cf_payees_list="") + cf_payees_list="", + summary="") EXAMPLE_CHILD_BUG2 = MockBug(bug_id=2, cf_budget_parent=1, cf_budget="10", cf_total_budget="10", cf_nlnet_milestone="milestone 1", - cf_payees_list="") + cf_payees_list="", + summary="") EXAMPLE_CONFIG = Config.from_str( """ @@ -242,43 +248,50 @@ class TestBudgetGraph(unittest.TestCase): cf_budget="0", cf_total_budget="0", cf_nlnet_milestone=None, - cf_payees_list=""), + cf_payees_list="", + summary=""), MockBug(bug_id=2, cf_budget_parent=1, cf_budget="0", cf_total_budget="0", cf_nlnet_milestone=None, - cf_payees_list=""), + cf_payees_list="", + summary=""), MockBug(bug_id=3, cf_budget_parent=1, cf_budget="0", cf_total_budget="0", cf_nlnet_milestone=None, - cf_payees_list=""), + cf_payees_list="", + summary=""), MockBug(bug_id=4, cf_budget_parent=1, cf_budget="0", cf_total_budget="0", cf_nlnet_milestone=None, - cf_payees_list=""), + cf_payees_list="", + summary=""), MockBug(bug_id=5, cf_budget_parent=3, cf_budget="0", cf_total_budget="0", cf_nlnet_milestone=None, - cf_payees_list=""), + cf_payees_list="", + summary=""), MockBug(bug_id=6, cf_budget_parent=3, cf_budget="0", cf_total_budget="0", cf_nlnet_milestone=None, - cf_payees_list=""), + cf_payees_list="", + summary=""), MockBug(bug_id=7, cf_budget_parent=5, cf_budget="0", cf_total_budget="0", cf_nlnet_milestone=None, - cf_payees_list=""), + cf_payees_list="", + summary=""), ], EXAMPLE_CONFIG) self.assertEqual(len(bg.nodes), 7) node1: Node = bg.nodes[1] @@ -301,7 +314,8 @@ class TestBudgetGraph(unittest.TestCase): cf_budget="0", cf_total_budget="10", cf_nlnet_milestone=None, - cf_payees_list=""), + cf_payees_list="", + summary=""), ], EXAMPLE_CONFIG) errors = bg.get_errors() self.assertErrorTypesMatches(errors, [ @@ -315,7 +329,8 @@ class TestBudgetGraph(unittest.TestCase): cf_budget="10", cf_total_budget="0", cf_nlnet_milestone=None, - cf_payees_list=""), + cf_payees_list="", + summary=""), ], EXAMPLE_CONFIG) errors = bg.get_errors() self.assertErrorTypesMatches(errors, [ @@ -329,7 +344,8 @@ class TestBudgetGraph(unittest.TestCase): cf_budget="10", cf_total_budget="10", cf_nlnet_milestone=None, - cf_payees_list=""), + cf_payees_list="", + summary=""), ], EXAMPLE_CONFIG) errors = bg.get_errors() self.assertErrorTypesMatches(errors, [BudgetGraphMoneyWithNoMilestone]) @@ -347,13 +363,15 @@ class TestBudgetGraph(unittest.TestCase): cf_budget=budget, cf_total_budget=total_budget, cf_nlnet_milestone="milestone 1", - cf_payees_list=payees_list), + cf_payees_list=payees_list, + summary=""), MockBug(bug_id=2, cf_budget_parent=1, cf_budget=child_budget, cf_total_budget=child_budget, cf_nlnet_milestone="milestone 1", - cf_payees_list=""), + cf_payees_list="", + summary=""), ], EXAMPLE_CONFIG) node1: Node = bg.nodes[1] errors = bg.get_errors() @@ -368,13 +386,15 @@ class TestBudgetGraph(unittest.TestCase): cf_total_budget=str( node1.fixed_budget_including_subtasks), cf_nlnet_milestone="milestone 1", - cf_payees_list=payees_list), + cf_payees_list=payees_list, + summary=""), MockBug(bug_id=2, cf_budget_parent=1, cf_budget=child_budget, cf_total_budget=child_budget, cf_nlnet_milestone="milestone 1", - cf_payees_list=""), + cf_payees_list="", + summary=""), ], EXAMPLE_CONFIG) errors = bg.get_errors() self.assertErrorTypesMatches(errors, @@ -666,7 +686,8 @@ class TestBudgetGraph(unittest.TestCase): cf_budget="0", cf_total_budget="-10", cf_nlnet_milestone="milestone 1", - cf_payees_list=""), + cf_payees_list="", + summary=""), ], EXAMPLE_CONFIG) errors = bg.get_errors() self.assertErrorTypesMatches(errors, [ @@ -683,7 +704,8 @@ class TestBudgetGraph(unittest.TestCase): cf_budget="-10", cf_total_budget="0", cf_nlnet_milestone="milestone 1", - cf_payees_list=""), + cf_payees_list="", + summary=""), ], EXAMPLE_CONFIG) errors = bg.get_errors() self.assertErrorTypesMatches(errors, [ @@ -700,7 +722,8 @@ class TestBudgetGraph(unittest.TestCase): cf_budget="-10", cf_total_budget="-10", cf_nlnet_milestone="milestone 1", - cf_payees_list=""), + cf_payees_list="", + summary=""), ], EXAMPLE_CONFIG) errors = bg.get_errors() self.assertErrorTypesMatches(errors, @@ -715,7 +738,8 @@ class TestBudgetGraph(unittest.TestCase): cf_budget="0", cf_total_budget="0", cf_nlnet_milestone="milestone 1", - cf_payees_list=cf_payees_list), + cf_payees_list=cf_payees_list, + summary=""), ], EXAMPLE_CONFIG) self.assertErrorTypesMatches(bg.get_errors(), error_types) self.assertEqual(len(bg.nodes), 1) @@ -942,7 +966,8 @@ class TestBudgetGraph(unittest.TestCase): cf_budget="10", cf_total_budget="10", cf_nlnet_milestone="milestone 1", - cf_payees_list="person1 = 5\nperson2 = 10"), + cf_payees_list="person1 = 5\nperson2 = 10", + summary=""), ], EXAMPLE_CONFIG) errors = bg.get_errors() self.assertErrorTypesMatches(errors, @@ -959,7 +984,8 @@ class TestBudgetGraph(unittest.TestCase): cf_budget="0", cf_total_budget="0", cf_nlnet_milestone="milestone 1", - cf_payees_list=cf_payees_list), + cf_payees_list=cf_payees_list, + summary=""), ], EXAMPLE_CONFIG).get_errors() self.assertErrorTypesMatches(errors, [BudgetGraphPayeesParseError]) @@ -1054,7 +1080,8 @@ class TestBudgetGraph(unittest.TestCase): cf_budget="10", cf_total_budget="10", cf_nlnet_milestone="milestone 1", - cf_payees_list="""person1 = -10"""), + cf_payees_list="""person1 = -10""", + summary=""), ], EXAMPLE_CONFIG) errors = bg.get_errors() self.assertErrorTypesMatches(errors, @@ -1077,7 +1104,8 @@ class TestBudgetGraph(unittest.TestCase): cf_payees_list=""" person1 = 5 alias1 = 5 - """), + """, + summary=""), ], EXAMPLE_CONFIG) errors = bg.get_errors() self.assertErrorTypesMatches(errors, @@ -1094,7 +1122,8 @@ class TestBudgetGraph(unittest.TestCase): cf_budget="10", cf_total_budget="10", cf_nlnet_milestone="milestone 2", - cf_payees_list=""), + cf_payees_list="", + summary=""), ], EXAMPLE_CONFIG) errors = bg.get_errors() self.assertErrorTypesMatches(errors, @@ -1109,7 +1138,8 @@ class TestBudgetGraph(unittest.TestCase): cf_budget="0", cf_total_budget="0", cf_nlnet_milestone="milestone 2", - cf_payees_list=""), + cf_payees_list="", + summary=""), ], EXAMPLE_CONFIG) errors = bg.get_errors() self.assertErrorTypesMatches(errors, []) @@ -1121,13 +1151,15 @@ class TestBudgetGraph(unittest.TestCase): cf_budget="10", cf_total_budget="10", cf_nlnet_milestone="milestone 1", - cf_payees_list="person1 = 3\nperson2 = 7"), + cf_payees_list="person1 = 3\nperson2 = 7", + summary=""), MockBug(bug_id=2, cf_budget_parent=None, cf_budget="10", cf_total_budget="10", cf_nlnet_milestone="milestone 2", - cf_payees_list="person3 = 5\nperson2 = 5"), + cf_payees_list="person3 = 5\nperson2 = 5", + summary=""), ], EXAMPLE_CONFIG) self.assertErrorTypesMatches(bg.get_errors(), []) person1 = EXAMPLE_CONFIG.people["person1"]