package cz.moneta.test.regression.cvm.api.inegrationgov;


import cz.moneta.test.dsl.Harness;
import cz.moneta.test.harness.annotations.TestCase;
import cz.moneta.test.harness.annotations.TestScenario;

import static cz.moneta.test.harness.annotations.Environment.PPE;
import static cz.moneta.test.harness.annotations.Environment.TST1;

@TestScenario(name = "Call API GET_CHECK_CONTROLS to WSO2 and assert response parameters")
public class ApiGetCheckControls {

    @TestCase(name = "Call API GET_CHECK_CONTROLS to WSO2", environments = {TST1, PPE})
    public void postGetCheckControls(Harness harness) {
        harness.tasks().wso2().restRequest().prepareRequestFromCvm("integration.gov/GET_CHECK_CONTROLS/001", true,
                "{\n" +
                        "  \"WFID\": \"CLCH_0000001101\"\n" +
                        "}")
                .post()
                .andAssertStatus(200)
                .andAssertFieldValue("tifResponseStatus.resultCode", "0")
                .andAssertPresent("RS_DATA")
                .andAssertPresent("RS_DATA[0]")
                .andAssertPresent("RS_DATA[0].PRODPACKAGEKEY")
                .andAssertPresent("RS_DATA[0].CIFAPPKEY")
                .andAssertPresent("RS_DATA[0].NAME");
    }
}
