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


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

    @TestCase(name = "Call API GET_UNI_PT_KEY to WSO2", environments = {TST1, PPE})
    public void postGetUniPtKey(Harness harness) {
        harness.tasks().wso2().restRequest().prepareRequestFromCvm("data.cluster/GET_UNI_PT_KEY/001", true,
                "{\n" +
                        "    \"BUS_ID\": \"GEMCB\",\n" +
                        "    \"UNI_PT_KEY_IN\": " + harness.getConfig("cvm.client.uniptkey") + "\n" +
                        "}")
                .post()
                .andAssertStatus(200)
                .andAssertPresent("RS_1")
                .andAssertPresent("RS_1[0]")
                .andAssertPresent("RS_1[0].PT_TYPE_OUT")
                .andAssertFieldValue("RS_1[0].UNI_PT_KEY_OUT", harness.getConfig("cvm.client.uniptkey"));
    }
}
