Skip to content

Commit

Permalink
🧪 test: adicionando o teste para o endpoint LICITACOES_VALORES_MENSAIS
Browse files Browse the repository at this point in the history
  • Loading branch information
thaleseuflauzino committed Aug 12, 2024
1 parent 68be995 commit 0c5d722
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion backend/server/app/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ def setUp(self):
LicitacaoQuantidade.objects.create(ano=2023, mes=2, total_licitacoes=10)
LicitacaoQuantidade.objects.create(ano=2023, mes=3, total_licitacoes=15)
LicitacaoQuantidade.objects.create(ano=2024, mes=1, total_licitacoes=0)

# para os endpoints de valores mensais e anuais
LicitacaoValoresMensal.objects.create(ano=2023, mes=1, valor_total=5000)
LicitacaoValoresMensal.objects.create(ano=2023, mes=2, valor_total=10000)
LicitacaoValoresMensal.objects.create(ano=2023, mes=3, valor_total=15000)
LicitacaoValoresMensal.objects.create(ano=2024, mes=1, valor_total=0)

# TESTE DO ENDPOINT NOME_ORGAOS_POR_ID
def test_nome_orgaos_por_id_valido(self):
Expand Down Expand Up @@ -146,6 +150,23 @@ def test_listar_licitacoes_quantidade_anual_vazio(self):
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(response.data, [])

# TESTE DO ENDPOINT LICITACOES_VALORES_MENSAIS
def test_licitacoes_valores_mensais(self):
response = self.client.get(reverse('licitacoes-valores-mensais'))
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(response.data, [
{'ano': 2023, 'mes': 1, 'valor_total': 5000},
{'ano': 2023, 'mes': 2, 'valor_total': 10000},
{'ano': 2023, 'mes': 3, 'valor_total': 15000},
{'ano': 2024, 'mes': 1, 'valor_total': 0}
])

def test_licitacoes_valores_mensais_vazio(self):
LicitacaoValoresMensal.objects.all().delete()
response = self.client.get(reverse('licitacoes-valores-mensais'))
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(response.data, [])

# TESTE DO ENDPOINT LICITACAO_MAIOR_VALOR
def test_licitacao_maior_valor(self):
# Fazer uma requisição GET para o endpoint
Expand Down

0 comments on commit 0c5d722

Please sign in to comment.