Ejemplo n.º 1
0
def test_create_existing_task(meta: MetadataRepository, project: Project,
                              task: Task, task2: Task):
    project_id = meta.create_project(project).id

    task.project_id = project_id
    task = meta.create_task(task)
    assert task is not None

    task2.name = task.name
    task2.project_id = project_id
    with pytest.raises(ExistingTaskError):
        meta.create_task(task2)
Ejemplo n.º 2
0
def test_create_task_is_reference(meta: MetadataRepository, project: Project,
                                  task: Task):
    task.project_id = meta.create_project(project).id
    expected_task = meta.create_task(task)
    assert expected_task is not None

    task.name = "KEK"

    actual_task = meta.get_task_by_id(expected_task.id)
    assert_objects_equal_except_fields(expected_task,
                                       actual_task,
                                       excepted_fields=['name'])
Ejemplo n.º 3
0
def test_save_updated_existing_task_with_existing_name(
        meta: MetadataRepository, project: Project):
    project = meta.create_project(project)
    task = Task("Task")
    task.project = project
    task = meta.create_task(task)

    task2 = Task("Task2")
    task2.project = project
    task2 = meta.create_task(task2)

    task.name = "Task2"
    with pytest.raises(ExistingTaskError):
        meta.save_task(task)