Untitled

 avatar
unknown
plain_text
a month ago
2.6 kB
7
Indexable
@Integration @API
Scenario Outline: parentalcontrol/v1 - Verify PIN set status
  When I make a successful IPVS parentalcontrol call with "<account>" and "<MSO>"
  Then the IPVS parentalcontrol response pinSet value should match SPP parentalControlPIN existence
  Examples:
    | account                       | MSO     |
    | LNK.8347:8347100040106596     | TWC     |
    | CHARTER.8286:8286101621622343 | CHARTER |






@When("I make a successful IPVS parentalcontrol call with {string} and {string}")
public void call_api_smarttv_parentalcontrol_v1(String account, String mso) {
    ResponseData.setData("accountId", account);
    ResponseData.setData("mso", mso);

    ServiceApiResponse response = restIPVS().apiSmarttvParentalControlV1(account, mso, "1.2.3.4").get();
    ResponseData.setResponse("apiSmarttvParentalControlV1", Objects.requireNonNull(response.json()));

    assertTrue(response.status().isSuccess(), response.uri() + " call is failing with " + response.status() + " and TXID: " + response.txId());
    assertNotNull(response.json().get("pinSet"), "Required field 'pinSet' not found");
}

@Then("the IPVS parentalcontrol response pinSet value should match SPP parentalControlPIN existence")
public void verify_pinset_matches_spp_parentalcontrolpin() {
    JSON ipvsResponse = ResponseData.getResponse("apiSmarttvParentalControlV1");
    String accountId = ResponseData.getData("accountId");
    
    ServiceApiResponse sppResponse = restSPP().accounts(accountId).get();
    assertTrue(sppResponse.status().isSuccess(), sppResponse.uri() + " call is failing with " + sppResponse.status() + " and TXID: " + sppResponse.txId());

    boolean ipvsPinSet = Boolean.parseBoolean(ipvsResponse.get("pinSet").toString());
    boolean hasParentalControlPin = sppResponse.json().hasField("parentalControlPIN");
    
    assertEquals(hasParentalControlPin, ipvsPinSet, 
        "IPVS pinSet=" + ipvsPinSet + " should match SPP parentalControlPIN existence=" + hasParentalControlPin + "; SPP response ID: " + sppResponse.txId());
}






public IPVSApiController apiSmarttvParentalControlV1(String xAccountId, String xMso, String xPiForwardedFor) {
    request.reset();
    request.path(API);
    request.path(SMARTTV);
    request.path(PARENTALCONTROL);
    request.path(V1);

    headerXAccountid(xAccountId);
    headerXMso(xMso);
    headerXPiForwardedFor(xPiForwardedFor);
    return this;
}






public SPPAccountResourceService accounts(String accountId) {
    request.reset();
    request.path(SPP);
    request.path(V1);
    request.path(ACCOUNTS);
    request.path(accountId);
    return this;
}


Editor is loading...
Leave a Comment