BudgetGraphNegativePayeeMoney, BudgetGraphPayeesParseError,
BudgetGraphPayeesMoneyMismatch, BudgetGraphUnknownMilestone,
BudgetGraphDuplicatePayeesForTask, BudgetGraphIncorrectRootForMilestone,
- BudgetGraphUnknownStatus)
+ BudgetGraphUnknownStatus, BudgetGraphUnknownAssignee)
from budget_sync.money import Money
from budget_sync.util import BugStatus
from typing import List, Type
"failed to parse status field of bug "
"#123: unknown status: 'fake status'")
+ def test_budget_graph_unknown_assignee(self):
+ self.assertEqual(str(BudgetGraphUnknownAssignee(
+ 123, "unknown@example.com")),
+ "Bug #123 is assigned to an unknown person:"
+ " 'unknown@example.com'")
+
def test_budget_graph_money_mismatch(self):
self.assertEqual(str(
BudgetGraphMoneyMismatchForBudgetExcludingSubtasks(
aliases = ["person1_alias1", "alias1"]
output_markdown_file = "person1.mdwn"
[people."person2"]
+ email = "person2@example.com"
aliases = ["person1_alias2", "alias2", "person 2"]
output_markdown_file = "person2.mdwn"
[people."person3"]
+ email = "user@example.com"
output_markdown_file = "person3.mdwn"
[milestones]
"milestone 1" = { canonical_bug_id = 1 }
"milestone_str='milestone 1', milestone=Milestone(config=..., "
"identifier='milestone 1', canonical_bug_id=1), "
"immediate_children=[#2], payments=[], "
- "status=BugStatus.CONFIRMED), Node(graph=..., id=#2, root=#1, "
+ "status=BugStatus.CONFIRMED, assignee=Person<'person3'>), "
+ "Node(graph=..., id=#2, root=#1, "
"parent=#1, budget_excluding_subtasks=10, "
"budget_including_subtasks=10, "
"fixed_budget_excluding_subtasks=10, "
"milestone_str='milestone 1', milestone=Milestone(config=..., "
"identifier='milestone 1', canonical_bug_id=1), "
"immediate_children=[], payments=[], "
- "status=BugStatus.CONFIRMED)], roots=[#1]}")
- bg = BudgetGraph([MockBug(bug_id=1, status="blah")],
+ "status=BugStatus.CONFIRMED, assignee=Person<'person3'>)], "
+ "roots=[#1]}")
+ bg = BudgetGraph([MockBug(bug_id=1, status="blah",
+ assigned_to="unknown@example.com")],
EXAMPLE_CONFIG)
self.assertEqual(
repr(bg),
"fixed_budget_excluding_subtasks=0, "
"fixed_budget_including_subtasks=0, milestone_str=None, "
"milestone=None, immediate_children=[], payments=[], "
- "status=<unknown status: 'blah'>)], roots=[#1]}")
+ "status=<unknown status: 'blah'>, "
+ "assignee=<unknown assignee: 'unknown@example.com'>)], "
+ "roots=[#1]}")
def test_empty(self):
bg = BudgetGraph([], EXAMPLE_CONFIG)
self.assertErrorTypesMatches(bg.get_errors(), [])
self.assertEqual(bg.nodes[1].status, status)
+ def test_assignee(self):
+ bg = BudgetGraph([MockBug(bug_id=1, assigned_to="blah")],
+ EXAMPLE_CONFIG)
+ errors = bg.get_errors()
+ self.assertErrorTypesMatches(errors,
+ [BudgetGraphUnknownAssignee])
+ self.assertEqual(errors[0].bug_id, 1)
+ self.assertEqual(errors[0].assignee, "blah")
+ bg = BudgetGraph([MockBug(bug_id=1,
+ assigned_to="person2@example.com")],
+ EXAMPLE_CONFIG)
+ self.assertErrorTypesMatches(bg.get_errors(), [])
+ self.assertEqual(bg.nodes[1].assignee,
+ EXAMPLE_CONFIG.people["person2"])
+
if __name__ == "__main__":
unittest.main()