def basic_scenario(): return ({ "id": 1, "goal": "Achieve Something", "name": "Usain", "state": "closed", "startDate": "2020-01-01T09:00:00.000+0100", "endDate": "2020-01-14T09:00:00.000+0100", "completeDate": "2020-01-14T09:00:00.000+0100" }, Sprint(id_=1, goal="Achieve Something", name="Usain", state="closed", start=datetime(2020, 1, 1, 9, 0, 0, tzinfo=timezone(timedelta(hours=1))), end=datetime(2020, 1, 14, 9, 0, 0, tzinfo=timezone(timedelta(hours=1)))))
def test_planned_issue_added_at_sprint_start(basic_scenario, base_issues, sprint_issues_lens): raw_json, _ = basic_scenario sprint = Sprint.from_parsed_json(raw_json, lambda x: base_issues) sprint = sprint_issues_lens[0].sprint_metrics.set( SprintMetrics(sprint_additions=[{ "timestamp": datetime(2020, 1, 1, 9, 0, 0, tzinfo=timezone(timedelta(hours=1))), "sprint_id": 1 }]))(sprint) assert sprint.planned_issue(sprint.issues[0]) is True
def test_started_because_finished_in_sprint(basic_scenario, base_issues, sprint_issues_lens): raw_json, _ = basic_scenario sprint = Sprint.from_parsed_json(raw_json, lambda x: base_issues) sprint = sprint_issues_lens[0].status_metrics.set( StatusMetrics(started=False, finished=True, start=None, end=datetime(2020, 1, 2, 9, 0, 0, tzinfo=timezone(timedelta(hours=1))), days_taken=1), )(sprint) assert sprint.started_in_sprint(sprint.issues[0]) is True
def test_no_sprint_metrics_means_unplanned(basic_scenario, base_issues): raw_json, _ = basic_scenario sprint = Sprint.from_parsed_json(raw_json, lambda x: base_issues) assert sprint.planned_issue(sprint.issues[0]) is False
def test_sprint_with_issue(basic_scenario, base_issues, sprint_issues_lens): raw_json, result = basic_scenario sprint = Sprint.from_parsed_json(raw_json, lambda x: base_issues) result = sprint_issues_lens.set(base_issues)(result) assert sprint == result
def test_basic_parsing(basic_scenario): raw_json, result = basic_scenario assert Sprint.from_parsed_json(raw_json) == result