def test_staff_from_less_level_hirearchy(self): assert_equal(find_arbitrator(self.ifile, "C3", "A3"), "F1")
def test_invalid_record_in_file(self): self.ifile = os.path.join(os.path.dirname(__file__), "invalid_record.input") with assert_raises(InvalidInput) as context: find_arbitrator(self.ifile, "E1", "F1") assert_true("Input file has an invalid" in str(context.exception))
def test_root_as_another_staff(self): assert_equal(find_arbitrator(self.ifile, "A1", "F1"), "F1")
def test_root_as_both_staff_manager(self): assert_equal(find_arbitrator(self.ifile, "F1", "F1"), "F1")
def test_staff_manager_same(self): assert_equal(find_arbitrator(self.ifile, "A1", "A1"), "B1")
def test_non_reporting_manager_as_staff(self): assert_equal(find_arbitrator(self.ifile, "A1", "B3"), "D1")
def test_a_manager_own_reporting_line_as_other_staff(self): assert_equal(find_arbitrator(self.ifile, "A1", "C1"), "D1")
def test_non_existing_manager(self): with assert_raises(InvalidInput) as context: find_arbitrator(self.ifile, "A1", "Unknown") assert_true("not found in Staff records" in str(context.exception))
def test_staffs_under_same_manager(self): assert_equal("B1", find_arbitrator(self.ifile, "A1", "A2"))