コード例 #1
0
def test_add_creates_plan():
    """ Add should create a new plan in the underlying data structure """
    # Given
    model = TreeModel()
    project = ResearchProject("")

    model.set_project(project)

    # When
    model.add_node(model.plans_index)

    # Then
    assert len(project.plans) == 1
コード例 #2
0
def test_add_creates_task():
    """ Add should create a new task in the underlying data structure """
    # Given
    model = TreeModel()
    project = ResearchProject("")
    plan = ResearchPlan()
    project.plans.append(plan)

    model.set_project(project)
    plan_index = model.index(0, 0, model.plans_index)

    # When
    model.add_node(plan_index)

    # Then
    assert len(project.plans) == 1
    assert len(plan.tasks) == 1