Esempio 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)
Esempio n. 2
0
def test_get_task_by_id(meta: MetadataRepository, project: Project,
                        task: Task):
    project = meta.create_project(project)
    task.project_id = project.id
    task_new = meta.create_task(
        task)  # Assume that we do not change the task var in the create_task.
    assert task_new is not None
    assert task_new == meta.get_task_by_id(task_new.id)
    assert task.has_meta_repo
Esempio n. 3
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'])
Esempio n. 4
0
def test_create_task(meta: MetadataRepository, project: Project, task: Task):
    task.project_id = meta.create_project(project).id
    task = meta.create_task(task)
    assert task is not None
    assert task.has_meta_repo
Esempio n. 5
0
def project_task(project):
    task = Task("Test Task")
    task.project_id = project
    return task