def test_get_list_with_multiple_todos(repository: Repository) -> None: id_1, text_1 = _insert_todo(repository, "This is a Todo!") id_2, text_2 = _insert_todo(repository, "This is a ANOTHER Todo!") todos = repository.list() assert todos == tuple( sorted((Todo(id=id_1, text=text_1, active=True), Todo(id=id_2, text=text_2, active=True))))
def test_delete_existing_todo(repository: Repository) -> None: id_1, _ = _insert_todo(repository, "This is a Todo!") id_2, text_2 = _insert_todo(repository, "This is a ANOTHER Todo!") result = repository.delete(id_1) assert result todos = repository.list() assert todos == (Todo(id=id_2, text=text_2, active=True), )
def test_mark_complete_existing_todo(repository: Repository) -> None: id_1, text_1 = _insert_todo(repository, "This is a Todo!") id_2, text_2 = _insert_todo(repository, "This is a ANOTHER Todo!") result = repository.deactivate(id_2) assert result todos = repository.list() assert todos == tuple( sorted((Todo(id=id_1, text=text_1, active=True), Todo(id=id_2, text=text_2, active=False))))
def test_edit_text_existing_todo(repository: Repository) -> None: id_1, text_1 = _insert_todo(repository, "This is a Todo!") id_2, text_2 = _insert_todo(repository, "This is a ANOTHER Todo!") result = repository.edit_text(id_2, "Hello") assert result todos = repository.list() assert todos == tuple( sorted((Todo(id=id_1, text=text_1, active=True), Todo(id=id_2, text="Hello", active=True))))
def test_get_list_with_single_todo(repository: Repository) -> None: id_, text = _insert_todo(repository, "This is a Todo!") todos = repository.list() assert todos == (Todo(id=id_, text=text, active=True), )
def test_get_empty_list(repository: Repository) -> None: todos = repository.list() assert todos == ()