Esempio n. 1
0
def test_parse_del():
    command = "- first task"
    numero = 1
    task_manager = TaskManager()

    action = task_manager.parsedel(command, numero)
    assert action.name == "del"
    assert action.numero == 1
Esempio n. 2
0
def test_parse_add():
    command = "+ Fourth task"
    task_manager = TaskManager()

    action = task_manager.parse(command)

    assert action.name == "add"
    assert action.description == "Fourth task"
Esempio n. 3
0
def test_parse_del():
    command = "- numero"
    numero = 1
    statut = "a faire"
    task_manager = TaskManager()

    action = task_manager.parse_del(command, numero, statut)

    assert action.numero == 1
Esempio n. 4
0
def test_parse_statut_o():
    command = "x numero"
    numero = 1
    statut = "fait"
    task_manager = TaskManager()

    action = task_manager.parse_statut_o(command, numero, statut)

    assert action.numero == 1
    assert action.statut == "fait"
Esempio n. 5
0
def test_parse_add():
    command = "+ first task"
    task_manager = TaskManager()
    numero = 1

    action = task_manager.parseadd(command, numero)

    assert action.name == "add"
    assert action.description == "first task"
    assert action.numero == 1
Esempio n. 6
0
def test_write_file_tasks():
    fichier = open("liste_taches.txt", "w")
    task_manager = TaskManager()
    tache1 = task_manager.parse_add("", "", "")
    fichier.write(tache1.name)
    fichier.write(" ")
    fichier.write(tache1.numero)
    fichier.write(" ")
    fichier.write(tache1.statut)
    fichier.write(" ")
    fichier.close()
Esempio n. 7
0
def test_parse_add():
    command = "+ first task"
    numero = 1
    statut = "a faire"
    task_manager = TaskManager()

    action = task_manager.parse_add(command,numero, statut)

    assert action.name == "add"
    assert action.description == "first task"
    assert action.statut == "a faire"
Esempio n. 8
0
def test_parse_delete():
    # Adding the task.
    command = "+ first task"
    task_manager = TaskManager()
    action = task_manager.parse(command)

    task_manager.parse_logic(action)
    task_added = task_manager.tasks[0]

    # Remove the task.
    command = "- first task"
    action = task_manager.parse(command)
    task_manager.parse_logic(action)

    # Check if task has been deleted.
    for _task in task_manager.tasks:
        if _task.id == task_added.id:
            AssertionError
Esempio n. 9
0
def test_can_create_a_task_manager():
    task_manager = TaskManager()
Esempio n. 10
0
def test_task_manager_starts_with_tasks():
    task_manager = TaskManager()
    assert task_manager.tasks == ["First task", "Second task", "Third task"]
Esempio n. 11
0
def task_manager(tmp_path):
    sqlite_path = tmp_path / "tasks.db"
    return TaskManager(sqlite_path)
Esempio n. 12
0
def test_repository():
    task_manager = TaskManager()
    tache1 = task_manager.parse_add("tache1", "1", "A faire")
    tasks = [tache1]

    assert task_manager.tasks == []
Esempio n. 13
0
def test_task_manager_starts_with_no_tasks():
    task_manager = TaskManager()

    assert task_manager.tasks == []
Esempio n. 14
0
def task_manager():
    sqlite_path = Path("tests.db")
    task_manager = TaskManager(sqlite_path)
    task_manager.repository.clean()
    return task_manager