Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

colocando limite na lista de tarefas e adicionando novo teste: #86

Open
mabittar opened this issue May 18, 2022 · 0 comments
Open

colocando limite na lista de tarefas e adicionando novo teste: #86

mabittar opened this issue May 18, 2022 · 0 comments

Comments

@mabittar
Copy link

@app.post(
    "/tarefas", response_model=TarefaResponse, status_code=status.HTTP_201_CREATED
)
def criar(tarefa: TarefaBase):
    nova_tarefa = tarefa.dict()
    nova_tarefa.update({"id": uuid4()})
    response = TarefaResponse(**nova_tarefa)
    TAREFAS.append(nova_tarefa)
    if len(TAREFAS) > 10:
        TarefasList.pop()
    return response

##

    def test_quando_criar_deve_persistir_ate_10(self):
        tarefa = {"titulo": "titulo", "descricao": "descricao"}
        i = 0
        while i < 15:
            self.cliente.post("/tarefas", json=tarefa)
            i += 1

        numero_tarefas = len(TarefasList)
        assert numero_tarefas == 10
        TarefasList.clear()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant