<commit_before>package br.gov.mj.sislegis.app.endpoint

import groovyx.net.http.RESTClient
import spock.lang.Specification

class ComentarioEndpointSpec extends Specification{

    def restClient = new RESTClient("http://localhost/")
    def cabecalho = [Authorization: new BearerToken().obterToken()]

    def "deve ocultar um comentario"(){
        def idComentario = 166
        def caminho = "sislegis/rest/comentarios/ocultar/" + idComentario

        when:
        def response = restClient.get(path: caminho, headers: cabecalho)

        then:
        assert response.status == 200 // status 200 = Ok
    }

}
<commit_msg>Criando testes para o endpoint de comentarios pensandoodireito/sislegis-app#126<commit_after>package br.gov.mj.sislegis.app.endpoint

import groovyx.net.http.ContentType
import groovyx.net.http.RESTClient
import spock.lang.Specification

class ComentarioEndpointSpec extends Specification{

    def restClient = new RESTClient("http://localhost/")
    def cabecalho = [Authorization: new BearerToken().obterToken()]

    def "deve salvar um novo comentario"(){
        given:
        def caminho = "sislegis/rest/comentarios/"

        def dados = [descricao  : "novo comentario teste teste",
                     proposicao : [id: 162]]

        when:
        def response = restClient.post(path: caminho, body: dados, headers: cabecalho, requestContentType: ContentType.JSON)

        then:
        assert response.status == 201 // status 201 = Created
    }

    def "deve listar os comentarios de uma proposicao"(){
        given:
        def idProposicao = 162
        def caminho = "sislegis/rest/comentarios/proposicao/" + idProposicao

        when:
        def response = restClient.get(path: caminho, headers: cabecalho)

        then:
        response.data.each {
            println it
        }
    }

    def "deve ocultar um comentario"(){
        def idComentario = 166
        def caminho = "sislegis/rest/comentarios/ocultar/" + idComentario

        when:
        def response = restClient.get(path: caminho, headers: cabecalho)

        then:
        assert response.status == 200 // status 200 = Ok
    }

}

{'fraction_non_alphanumeric': 0.09499536607970342, 'fraction_numerical': 0.015291936978683966, 'mean_word_length': 2.6843003412969284, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6892090', 'n_tokens_mistral': 718, 'n_tokens_neox': 656, 'n_words': 164}