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


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_APPS_STATES to WSO2 and assert response parameters")
public class ApiGetAppsStates {

    @TestCase(name = "Call API GET_APPS_STATES to WSO2", environments = {TST1, PPE})
    public void postGetAppsStates(Harness harness) {
        harness.tasks().wso2().restRequest().prepareRequestFromCvm("risk.cluster/NAS/GET_APPS_STATES/001", true,
                "{\n" +
                        "  \"RS_IN\": [\n" +
                        "    {\n" +
                        "      \"APP_KEY\": " + harness.getConfig("cvm.application.key") + "\n" +
                        "    }\n" +
                        "  ]\n" +
                        "}")
                .post()
                .andAssertStatus(200)
                .andAssertFieldValue("tifResponseStatus.resultCode", "0")
                .andAssertPresent("RS_OUT");
    }
}
