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

Make data_assinatura_tcr not nullable #129

Merged
merged 4 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,13 +388,13 @@ class PlanoTrabalho(Base):
origem_unidade,
cod_unidade_autorizadora,
matricula_siape,
cod_unidade_lotacao_participante
cod_unidade_lotacao_participante,
],
[
"participante.origem_unidade",
"participante.cod_unidade_autorizadora",
"participante.matricula_siape",
"participante.cod_unidade_lotacao"
"participante.cod_unidade_lotacao",
],
),
UniqueConstraint(
Expand Down
2 changes: 1 addition & 1 deletion src/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ class ParticipanteSchema(BaseModel):
title="Modalidade e regime de execução do trabalho",
description=Participante.modalidade_execucao.comment,
)
data_assinatura_tcr: Optional[PastDatetime] = Field(
data_assinatura_tcr: PastDatetime = Field(
title="Data de assinatura do TCR",
description=Participante.data_assinatura_tcr.comment,
)
Expand Down
13 changes: 13 additions & 0 deletions tests/participantes_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,19 @@ def test_create_participante_invalid_modalidade_execucao(
for error in response.json().get("detail")
)

def test_create_participante_data_assinatura_tcr_not_null(self):
"""Tenta criar um participante com valor nulo para o campo
data_assinatura_tcr.
"""
input_part = self.input_part.copy()
input_part["data_assinatura_tcr"] = None
response = self.put_participante(input_part)
assert response.status_code == status.HTTP_422_UNPROCESSABLE_ENTITY
assert any(
"Input should be a valid datetime" in error["msg"]
for error in response.json().get("detail", [])
)


class TestGetParticipante(BaseParticipanteTest):
"""Testes para a leitura de Participantes."""
Expand Down