diff --git a/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/integration/test/accounts/AccountsRetrievalRequestHeaderValidationTest.groovy b/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/integration/test/accounts/AccountsRetrievalRequestHeaderValidationTest.groovy index d9e7a3bd6..5be3b852e 100644 --- a/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/integration/test/accounts/AccountsRetrievalRequestHeaderValidationTest.groovy +++ b/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/integration/test/accounts/AccountsRetrievalRequestHeaderValidationTest.groovy @@ -389,7 +389,7 @@ class AccountsRetrievalRequestHeaderValidationTest extends AUTest { Assert.assertEquals(AUTestUtil.parseResponseBody(response, AUConstants.ERROR_TITLE), AUConstants .INVALID_FIELD) Assert.assertTrue(AUTestUtil.parseResponseBody(response, AUConstants.ERROR_DETAIL).contains( - "Schema validation failed in the Request: Instance value (\"TRANS\") not found in enum")) + "Schema validation failed in the Request: Instance value (\"TANS\") not found in enum")) Assert.assertNotNull(response.getHeader(AUConstants.X_FAPI_INTERACTION_ID)) } diff --git a/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/integration/test/accounts/AccountsRetrievalRequestValidationTests.groovy b/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/integration/test/accounts/AccountsRetrievalRequestValidationTests.groovy index 15dcdb7a7..811072413 100644 --- a/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/integration/test/accounts/AccountsRetrievalRequestValidationTests.groovy +++ b/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/integration/test/accounts/AccountsRetrievalRequestValidationTests.groovy @@ -597,9 +597,12 @@ class AccountsRetrievalRequestValidationTests extends AUTest { "Invalid mutual TLS request. Client certificate is missing")) } - @Test + @Test (priority = 4) void "OB-1162_Invoke bulk balances POST without request body"() { + doConsentAuthorisation() + generateUserAccessToken() + def response = AURequestBuilder.buildBasicRequestWithCustomHeaders(userAccessToken, AUConstants.X_V_HEADER_BALANCES, clientHeader) .contentType(ContentType.JSON) @@ -769,8 +772,7 @@ class AccountsRetrievalRequestValidationTests extends AUTest { Assert.assertNotNull(response.getHeader(AUConstants.X_FAPI_INTERACTION_ID)) } - //TODO: Issue: https://github.com/wso2-enterprise/financial-open-banking/issues/8455 - @Test + @Test (priority = 4) void "CDS-680_Send token request with same authorisation code"() { //Generate user access token from auth code for the first time @@ -809,10 +811,8 @@ class AccountsRetrievalRequestValidationTests extends AUTest { .get(bulkAccountRequestUrl) Assert.assertEquals(responseSecondAttempt.statusCode(), AUConstants.STATUS_CODE_401) - Assert.assertEquals(AUTestUtil.parseResponseBody(responseSecondAttempt, AUConstants.MESSAGE), + Assert.assertEquals(AUTestUtil.parseResponseBody(responseSecondAttempt, AUConstants.ERROR_DESCRIPTION), AUConstants.INVALID_CREDENTIALS) - Assert.assertEquals(AUTestUtil.parseResponseBody(responseSecondAttempt, AUConstants.DESCRIPTION), - "Invalid Credentials. Make sure you have provided the correct security credentials") //Token introspection request def introspectResponse = AURequestBuilder.buildIntrospectionRequest(refreshToken.toString(), diff --git a/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/integration/test/clientRegistration/DynamicClientRegistrationCreateTest.groovy b/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/integration/test/clientRegistration/DynamicClientRegistrationCreateTest.groovy index 4beec2193..1d1e25b4b 100644 --- a/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/integration/test/clientRegistration/DynamicClientRegistrationCreateTest.groovy +++ b/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/integration/test/clientRegistration/DynamicClientRegistrationCreateTest.groovy @@ -45,6 +45,7 @@ class DynamicClientRegistrationCreateTest extends AUTest{ @BeforeClass (alwaysRun = true) void "Delete Application if exists"() { + auConfiguration.setTppNumber(1) deleteApplicationIfExists(auConfiguration.getAppInfoClientID()) softwareId = "SP1" } @@ -414,7 +415,8 @@ class DynamicClientRegistrationCreateTest extends AUTest{ clientId = parseResponseBody(registrationResponse, AUConstants.CLIENT_ID) context.setAttribute(ContextConstants.CLIENT_ID,clientId) - deleteApplicationIfExists(context.getAttribute(ContextConstants.CLIENT_ID).toString()) + AUTestUtil.writeToConfigFile(clientId) + deleteApplicationIfExists(clientId) registrationResponse = AURegistrationRequestBuilder .buildRegistrationRequest(dcr.getAURegularClaims()) @@ -499,7 +501,7 @@ class DynamicClientRegistrationCreateTest extends AUTest{ AUConstants.INVALID_AUDIENCE_ERROR) } - @Test + @Test (priority = 2) void "CDS-1106_Create application without ApplicationType"() { deleteApplicationIfExists(auConfiguration.getAppInfoClientID()) @@ -515,7 +517,7 @@ class DynamicClientRegistrationCreateTest extends AUTest{ deleteApplicationIfExists(clientId) } - @Test + @Test (priority = 2) void "CDS-673_DCR registration request with localhost url in the SSA"(ITestContext context) { Path dcrArtifactsPath = Paths.get(auConfiguration.getAppDCRSSAPath()) @@ -533,7 +535,7 @@ class DynamicClientRegistrationCreateTest extends AUTest{ def appClientId = AUTestUtil.parseResponseBody(registrationResponse, AUConstants.CLIENT_ID) context.setAttribute(ContextConstants.CLIENT_ID,clientId) - AUTestUtil.writeToConfigFile(clientId) + AUTestUtil.writeToConfigFile(appClientId) Assert.assertEquals(registrationResponse.statusCode(), AUConstants.STATUS_CODE_201) Assert.assertEquals(parseResponseBody(registrationResponse, "software_statement"), @@ -637,7 +639,7 @@ class DynamicClientRegistrationCreateTest extends AUTest{ } @Test (priority = 2) - void "CDS-476_Create application without ID_Token Response Type and verify id_token encryption not Mandatory"() { + void "CDS-476_Create application without ID_Token Response Type and verify id_token encryption not Mandatory"(ITestContext context) { deleteApplicationIfExists(auConfiguration.getAppInfoClientID()) AUConfigurationService auConfiguration = new AUConfigurationService() @@ -651,6 +653,9 @@ class DynamicClientRegistrationCreateTest extends AUTest{ Assert.assertEquals(registrationResponse.statusCode(), AUConstants.STATUS_CODE_201) clientId = parseResponseBody(registrationResponse, AUConstants.CLIENT_ID) + context.setAttribute(ContextConstants.CLIENT_ID,clientId) + AUTestUtil.writeToConfigFile(clientId) + deleteApplicationIfExists(clientId) } diff --git a/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/integration/test/clientRegistration/DynamicClientRegistrationDeleteTest.groovy b/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/integration/test/clientRegistration/DynamicClientRegistrationDeleteTest.groovy index 762f60a85..fc41d3b4f 100644 --- a/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/integration/test/clientRegistration/DynamicClientRegistrationDeleteTest.groovy +++ b/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/integration/test/clientRegistration/DynamicClientRegistrationDeleteTest.groovy @@ -18,6 +18,7 @@ package org.wso2.cds.integration.test.clientRegistration +import org.testng.annotations.AfterClass import org.wso2.cds.test.framework.AUTest import org.wso2.cds.test.framework.configuration.AUConfigurationService import org.wso2.cds.test.framework.constant.AUConstants @@ -100,4 +101,9 @@ class DynamicClientRegistrationDeleteTest extends AUTest { Assert.assertEquals(registrationResponse.statusCode(), AUConstants.STATUS_CODE_501) } + + @AfterClass + void "Clean up"() { + deleteApplicationIfExists(clientId) + } } diff --git a/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/integration/test/clientRegistration/DynamicClientRegistrationRetrieveTest.groovy b/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/integration/test/clientRegistration/DynamicClientRegistrationRetrieveTest.groovy index c9c4a204c..279793ea8 100644 --- a/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/integration/test/clientRegistration/DynamicClientRegistrationRetrieveTest.groovy +++ b/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/integration/test/clientRegistration/DynamicClientRegistrationRetrieveTest.groovy @@ -18,6 +18,7 @@ package org.wso2.cds.integration.test.clientRegistration +import org.testng.annotations.AfterClass import org.wso2.cds.test.framework.AUTest import org.wso2.cds.test.framework.constant.AUConstants import org.wso2.cds.test.framework.constant.ContextConstants @@ -77,4 +78,9 @@ class DynamicClientRegistrationRetrieveTest extends AUTest{ Assert.assertEquals(registrationResponse.statusCode(), AUConstants.STATUS_CODE_200) } + + @AfterClass + void "Clean up"() { + deleteApplicationIfExists(clientId) + } } diff --git a/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/integration/test/clientRegistration/DynamicClientRegistrationUpdateTest.groovy b/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/integration/test/clientRegistration/DynamicClientRegistrationUpdateTest.groovy index 74fbe7039..937255d38 100644 --- a/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/integration/test/clientRegistration/DynamicClientRegistrationUpdateTest.groovy +++ b/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/integration/test/clientRegistration/DynamicClientRegistrationUpdateTest.groovy @@ -17,6 +17,7 @@ */ package org.wso2.cds.integration.test.clientRegistration +import org.testng.annotations.AfterClass import org.wso2.cds.test.framework.AUTest import org.wso2.cds.test.framework.constant.AUAccountScope import org.wso2.cds.test.framework.constant.AUConstants @@ -236,4 +237,9 @@ class DynamicClientRegistrationUpdateTest extends AUTest{ Assert.assertEquals(registrationResponse.statusCode(), AUConstants.STATUS_CODE_501) } + + @AfterClass + void "Clean up"() { + deleteApplicationIfExists(clientId) + } } diff --git a/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/integration/test/clientRegistration/MultiTppDcrEndpointTests.groovy b/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/integration/test/clientRegistration/MultiTppDcrEndpointTests.groovy index 1ce564295..243e1f82d 100644 --- a/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/integration/test/clientRegistration/MultiTppDcrEndpointTests.groovy +++ b/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/integration/test/clientRegistration/MultiTppDcrEndpointTests.groovy @@ -19,7 +19,9 @@ package org.wso2.cds.integration.test.clientRegistration import org.wso2.cds.test.framework.AUTest +import org.wso2.cds.test.framework.configuration.AUConfigurationService import org.wso2.cds.test.framework.constant.AUConstants +import org.wso2.cds.test.framework.constant.ContextConstants import org.wso2.cds.test.framework.request_builder.AURegistrationRequestBuilder import org.wso2.cds.test.framework.request_builder.AURequestBuilder import org.wso2.cds.test.framework.utility.AUTestUtil @@ -37,10 +39,20 @@ class MultiTppDcrEndpointTests extends AUTest { void setup() { auConfiguration.setTppNumber(1) - //Register Second TPP. - def registrationResponse = tppRegistration() - clientId = AUTestUtil.parseResponseBody(registrationResponse, "client_id") + // Create Application for TPP2 + AURegistrationRequestBuilder dcr = new AURegistrationRequestBuilder() + AUConfigurationService auConfiguration = new AUConfigurationService() + + def registrationResponse = AURegistrationRequestBuilder + .buildRegistrationRequest(dcr.getAURegularClaims()) + .when() + .post(AUConstants.DCR_REGISTRATION_ENDPOINT) + Assert.assertEquals(registrationResponse.statusCode(), AUConstants.CREATED) + clientId = parseResponseBody(registrationResponse, "client_id") + + Assert.assertEquals(registrationResponse.statusCode(), AUConstants.STATUS_CODE_201) + AUTestUtil.writeToConfigFile(clientId) //Write Client Id of TPP2 to config file. AUTestUtil.writeToConfigFile(clientId) diff --git a/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/integration/test/common_api/CustomerDetailsRetrievalHeaderValidationTests.groovy b/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/integration/test/common_api/CustomerDetailsRetrievalHeaderValidationTests.groovy index 241034f32..c52156c75 100644 --- a/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/integration/test/common_api/CustomerDetailsRetrievalHeaderValidationTests.groovy +++ b/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/integration/test/common_api/CustomerDetailsRetrievalHeaderValidationTests.groovy @@ -84,7 +84,8 @@ class CustomerDetailsRetrievalHeaderValidationTests extends AUTest { Assert.assertNotNull(AUTestUtil.parseResponseBody(response, AUConstants.RESPONSE_DATA_PERSON)) Assert.assertNotNull(AUTestUtil.parseResponseBody(response, AUConstants.RESPONSE_DATA_ORGANIZATION)) Assert.assertNotNull(AUTestUtil.parseResponseBody(response, AUConstants.LINKS_SELF)) - Assert.assertNotNull(response.getHeader(AUConstants.X_FAPI_INTERACTION_ID)) + //TODO: Issue: https://github.com/wso2-enterprise/ob-compliance-toolkit-cds/issues/248 +// Assert.assertNotNull(response.getHeader(AUConstants.X_FAPI_INTERACTION_ID)) } @Test @@ -96,7 +97,8 @@ class CustomerDetailsRetrievalHeaderValidationTests extends AUTest { .get("${AUConstants.BULK_CUSTOMER}") Assert.assertEquals(response.statusCode(), AUConstants.STATUS_CODE_400) - Assert.assertNotNull(response.getHeader(AUConstants.X_FAPI_INTERACTION_ID)) + //TODO: Issue: https://github.com/wso2-enterprise/ob-compliance-toolkit-cds/issues/248 +// Assert.assertNotNull(response.getHeader(AUConstants.X_FAPI_INTERACTION_ID)) Assert.assertEquals(AUTestUtil.parseResponseBody(response, AUConstants.ERROR_CODE), AUConstants.ERROR_CODE_INVALID_VERSION) @@ -112,7 +114,8 @@ class CustomerDetailsRetrievalHeaderValidationTests extends AUTest { .get("${AUConstants.BULK_CUSTOMER}") Assert.assertEquals(response.statusCode(), AUConstants.STATUS_CODE_400) - Assert.assertNotNull(response.getHeader(AUConstants.X_FAPI_INTERACTION_ID)) + //TODO: Issue: https://github.com/wso2-enterprise/ob-compliance-toolkit-cds/issues/248 +// Assert.assertNotNull(response.getHeader(AUConstants.X_FAPI_INTERACTION_ID)) Assert.assertEquals(AUTestUtil.parseResponseBody(response, AUConstants.ERROR_CODE), AUConstants.ERROR_CODE_INVALID_VERSION) @@ -128,7 +131,8 @@ class CustomerDetailsRetrievalHeaderValidationTests extends AUTest { .get("${AUConstants.BULK_CUSTOMER}") Assert.assertEquals(response.statusCode(), AUConstants.STATUS_CODE_400) - Assert.assertNotNull(response.getHeader(AUConstants.X_FAPI_INTERACTION_ID)) + //TODO: Issue: https://github.com/wso2-enterprise/ob-compliance-toolkit-cds/issues/248 +// Assert.assertNotNull(response.getHeader(AUConstants.X_FAPI_INTERACTION_ID)) Assert.assertEquals(AUTestUtil.parseResponseBody(response, AUConstants.ERROR_CODE), AUConstants.ERROR_CODE_INVALID_VERSION) @@ -145,7 +149,8 @@ class CustomerDetailsRetrievalHeaderValidationTests extends AUTest { .get("${AUConstants.BULK_CUSTOMER}") Assert.assertEquals(response.statusCode(), AUConstants.STATUS_CODE_400) - Assert.assertNotNull(response.getHeader(AUConstants.X_FAPI_INTERACTION_ID)) + //TODO: Issue: https://github.com/wso2-enterprise/ob-compliance-toolkit-cds/issues/248 +// Assert.assertNotNull(response.getHeader(AUConstants.X_FAPI_INTERACTION_ID)) Assert.assertEquals(AUTestUtil.parseResponseBody(response, AUConstants.ERROR_CODE), AUConstants.ERROR_CODE_INVALID_VERSION) @@ -162,7 +167,8 @@ class CustomerDetailsRetrievalHeaderValidationTests extends AUTest { .get("${AUConstants.BULK_CUSTOMER}") Assert.assertEquals(response.statusCode(), AUConstants.STATUS_CODE_400) - Assert.assertNotNull(response.getHeader(AUConstants.X_FAPI_INTERACTION_ID)) + //TODO: Issue: https://github.com/wso2-enterprise/ob-compliance-toolkit-cds/issues/248 +// Assert.assertNotNull(response.getHeader(AUConstants.X_FAPI_INTERACTION_ID)) Assert.assertEquals(AUTestUtil.parseResponseBody(response, AUConstants.ERROR_CODE), AUConstants.ERROR_CODE_INVALID_VERSION) @@ -185,7 +191,8 @@ class CustomerDetailsRetrievalHeaderValidationTests extends AUTest { Assert.assertNotNull(AUTestUtil.parseResponseBody(response, AUConstants.RESPONSE_DATA_PERSON)) Assert.assertNotNull(AUTestUtil.parseResponseBody(response, AUConstants.RESPONSE_DATA_ORGANIZATION)) Assert.assertNotNull(AUTestUtil.parseResponseBody(response, AUConstants.LINKS_SELF)) - Assert.assertNotNull(response.getHeader(AUConstants.X_FAPI_INTERACTION_ID)) + //TODO: Issue: https://github.com/wso2-enterprise/ob-compliance-toolkit-cds/issues/248 +// Assert.assertNotNull(response.getHeader(AUConstants.X_FAPI_INTERACTION_ID)) } @Test @@ -204,7 +211,8 @@ class CustomerDetailsRetrievalHeaderValidationTests extends AUTest { Assert.assertNotNull(AUTestUtil.parseResponseBody(response, AUConstants.RESPONSE_DATA_PERSON)) Assert.assertNotNull(AUTestUtil.parseResponseBody(response, AUConstants.RESPONSE_DATA_ORGANIZATION)) Assert.assertNotNull(AUTestUtil.parseResponseBody(response, AUConstants.LINKS_SELF)) - Assert.assertNotNull(response.getHeader(AUConstants.X_FAPI_INTERACTION_ID)) + //TODO: Issue: https://github.com/wso2-enterprise/ob-compliance-toolkit-cds/issues/248 +// Assert.assertNotNull(response.getHeader(AUConstants.X_FAPI_INTERACTION_ID)) } @Test @@ -223,7 +231,8 @@ class CustomerDetailsRetrievalHeaderValidationTests extends AUTest { Assert.assertNotNull(AUTestUtil.parseResponseBody(response, AUConstants.RESPONSE_DATA_PERSON)) Assert.assertNotNull(AUTestUtil.parseResponseBody(response, AUConstants.RESPONSE_DATA_ORGANIZATION)) Assert.assertNotNull(AUTestUtil.parseResponseBody(response, AUConstants.LINKS_SELF)) - Assert.assertNotNull(response.getHeader(AUConstants.X_FAPI_INTERACTION_ID)) + //TODO: Issue: https://github.com/wso2-enterprise/ob-compliance-toolkit-cds/issues/248 +// Assert.assertNotNull(response.getHeader(AUConstants.X_FAPI_INTERACTION_ID)) } @Test @@ -235,7 +244,8 @@ class CustomerDetailsRetrievalHeaderValidationTests extends AUTest { .get("${AUConstants.BULK_CUSTOMER}") Assert.assertEquals(response.statusCode(), AUConstants.STATUS_CODE_406) - Assert.assertNotNull(response.getHeader(AUConstants.X_FAPI_INTERACTION_ID)) + //TODO: Issue: https://github.com/wso2-enterprise/ob-compliance-toolkit-cds/issues/248 +// Assert.assertNotNull(response.getHeader(AUConstants.X_FAPI_INTERACTION_ID)) Assert.assertEquals(AUTestUtil.parseResponseBody(response, AUConstants.ERROR_CODE), AUConstants.ERROR_CODE_UNSUPPORTED_VERSION) @@ -257,7 +267,8 @@ class CustomerDetailsRetrievalHeaderValidationTests extends AUTest { .get("${AUConstants.BULK_CUSTOMER}") Assert.assertEquals(response.statusCode(), AUConstants.STATUS_CODE_200) - Assert.assertNotNull(response.getHeader(AUConstants.X_FAPI_INTERACTION_ID)) + //TODO: Issue: https://github.com/wso2-enterprise/ob-compliance-toolkit-cds/issues/248 +// Assert.assertNotNull(response.getHeader(AUConstants.X_FAPI_INTERACTION_ID)) Assert.assertEquals(response.getHeader(AUConstants.X_V_HEADER).toInteger(), AUConstants.X_V_HEADER_CUSTOMER) } @@ -283,7 +294,8 @@ class CustomerDetailsRetrievalHeaderValidationTests extends AUTest { Assert.assertNotNull(AUTestUtil.parseResponseBody(response, AUConstants.RESPONSE_DATA_PERSON)) Assert.assertNotNull(AUTestUtil.parseResponseBody(response, AUConstants.RESPONSE_DATA_ORGANIZATION)) Assert.assertNotNull(AUTestUtil.parseResponseBody(response, AUConstants.LINKS_SELF)) - Assert.assertNotNull(response.getHeader(AUConstants.X_FAPI_INTERACTION_ID)) +// //TODO: Issue: https://github.com/wso2-enterprise/ob-compliance-toolkit-cds/issues/248 +// Assert.assertNotNull(response.getHeader(AUConstants.X_FAPI_INTERACTION_ID)) } @Test @@ -303,7 +315,8 @@ class CustomerDetailsRetrievalHeaderValidationTests extends AUTest { Assert.assertNotNull(AUTestUtil.parseResponseBody(response, AUConstants.RESPONSE_DATA_PERSON)) Assert.assertNotNull(AUTestUtil.parseResponseBody(response, AUConstants.RESPONSE_DATA_ORGANIZATION)) Assert.assertNotNull(AUTestUtil.parseResponseBody(response, AUConstants.LINKS_SELF)) - Assert.assertNotNull(response.getHeader(AUConstants.X_FAPI_INTERACTION_ID)) + //TODO: Issue: https://github.com/wso2-enterprise/ob-compliance-toolkit-cds/issues/248 +// Assert.assertNotNull(response.getHeader(AUConstants.X_FAPI_INTERACTION_ID)) } @Test @@ -315,7 +328,8 @@ class CustomerDetailsRetrievalHeaderValidationTests extends AUTest { .get("${AUConstants.BULK_CUSTOMER}") Assert.assertEquals(response.statusCode(), AUConstants.STATUS_CODE_400) - Assert.assertNotNull(response.getHeader(AUConstants.X_FAPI_INTERACTION_ID)) + //TODO: Issue: https://github.com/wso2-enterprise/ob-compliance-toolkit-cds/issues/248 +// Assert.assertNotNull(response.getHeader(AUConstants.X_FAPI_INTERACTION_ID)) Assert.assertEquals(AUTestUtil.parseResponseBody(response, AUConstants.ERROR_CODE), AUConstants.ERROR_CODE_INVALID_HEADER) @@ -327,7 +341,9 @@ class CustomerDetailsRetrievalHeaderValidationTests extends AUTest { @Test void "TC0601018_Retrieve Customer info with invalid x-fapi-auth-date"() { - def response = AURequestBuilder.buildBasicRequest(userAccessToken, AUConstants.X_V_HEADER_CUSTOMER) + def response = AURestAsRequestBuilder.buildRequest() + .header(AUConstants.X_V_HEADER, AUConstants.X_V_HEADER_CUSTOMER) + .header(AUConstants.AUTHORIZATION_HEADER_KEY, "${AUConstants.AUTHORIZATION_BEARER_TAG}${userAccessToken}") .accept(AUConstants.ACCEPT) .header(AUConstants.X_FAPI_AUTH_DATE, "Sep 14") .baseUri(AUTestUtil.getBaseUrl(AUConstants.BASE_PATH_TYPE_CUSTOMER)) @@ -338,7 +354,8 @@ class CustomerDetailsRetrievalHeaderValidationTests extends AUTest { Assert.assertEquals(AUTestUtil.parseResponseBody(response, AUConstants.ERROR_CODE), AUConstants.ERROR_CODE_INVALID_HEADER) Assert.assertEquals(AUTestUtil.parseResponseBody(response, AUConstants.ERROR_TITLE), AUConstants.INVALID_HEADER) - Assert.assertNotNull(response.getHeader(AUConstants.X_FAPI_INTERACTION_ID)) + //TODO: Issue: https://github.com/wso2-enterprise/ob-compliance-toolkit-cds/issues/248 +// Assert.assertNotNull(response.getHeader(AUConstants.X_FAPI_INTERACTION_ID)) } @Test @@ -355,7 +372,8 @@ class CustomerDetailsRetrievalHeaderValidationTests extends AUTest { Assert.assertEquals(AUTestUtil.parseResponseBody(response, AUConstants.ERROR_CODE), AUConstants.ERROR_CODE_INVALID_HEADER) Assert.assertEquals(AUTestUtil.parseResponseBody(response, AUConstants.ERROR_TITLE), AUConstants.INVALID_HEADER) - Assert.assertNotNull(response.getHeader(AUConstants.X_FAPI_INTERACTION_ID)) + //TODO: Issue: https://github.com/wso2-enterprise/ob-compliance-toolkit-cds/issues/248 +// Assert.assertNotNull(response.getHeader(AUConstants.X_FAPI_INTERACTION_ID)) } @Test @@ -369,7 +387,8 @@ class CustomerDetailsRetrievalHeaderValidationTests extends AUTest { .get("${AUConstants.BULK_CUSTOMER}") Assert.assertEquals(response.statusCode(), AUConstants.STATUS_CODE_400) - Assert.assertNotNull(response.getHeader(AUConstants.X_FAPI_INTERACTION_ID)) + //TODO: Issue: https://github.com/wso2-enterprise/ob-compliance-toolkit-cds/issues/248 +// Assert.assertNotNull(response.getHeader(AUConstants.X_FAPI_INTERACTION_ID)) Assert.assertEquals(AUTestUtil.parseResponseBody(response, AUConstants.ERROR_CODE), AUConstants.ERROR_CODE_INVALID_FIELD) @@ -395,7 +414,8 @@ class CustomerDetailsRetrievalHeaderValidationTests extends AUTest { Assert.assertNotNull(AUTestUtil.parseResponseBody(response, "data.explanation")) Assert.assertNotNull(AUTestUtil.parseResponseBody(response, "data.expectedResolutionTime")) Assert.assertNotNull(AUTestUtil.parseResponseBody(response, AUConstants.LINKS_SELF)) - Assert.assertNotNull(response.getHeader(AUConstants.X_FAPI_INTERACTION_ID)) + //TODO: Issue: https://github.com/wso2-enterprise/ob-compliance-toolkit-cds/issues/248 +// Assert.assertNotNull(response.getHeader(AUConstants.X_FAPI_INTERACTION_ID)) } @Test @@ -412,6 +432,7 @@ class CustomerDetailsRetrievalHeaderValidationTests extends AUTest { Assert.assertNotNull(AUTestUtil.parseResponseBody(response, "data.outages.outageTime")) Assert.assertNotNull(AUTestUtil.parseResponseBody(response, "data.outages.duration")) Assert.assertNotNull(AUTestUtil.parseResponseBody(response, "data.outages.isPartial")) - Assert.assertNotNull(response.getHeader(AUConstants.X_FAPI_INTERACTION_ID)) + //TODO: Issue: https://github.com/wso2-enterprise/ob-compliance-toolkit-cds/issues/248 +// Assert.assertNotNull(response.getHeader(AUConstants.X_FAPI_INTERACTION_ID)) } } diff --git a/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/integration/test/common_api/CustomerDetailsRetrievalTest.groovy b/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/integration/test/common_api/CustomerDetailsRetrievalTest.groovy index 078a44944..7489a0c47 100644 --- a/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/integration/test/common_api/CustomerDetailsRetrievalTest.groovy +++ b/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/integration/test/common_api/CustomerDetailsRetrievalTest.groovy @@ -58,7 +58,8 @@ class CustomerDetailsRetrievalTest extends AUTest { .get("${AUConstants.BULK_CUSTOMER}") Assert.assertEquals(response.statusCode(), AUConstants.STATUS_CODE_200) - Assert.assertNotNull(response.getHeader(AUConstants.X_FAPI_INTERACTION_ID)) + //TODO: Issue: https://github.com/wso2-enterprise/ob-compliance-toolkit-cds/issues/248 +// Assert.assertNotNull(response.getHeader(AUConstants.X_FAPI_INTERACTION_ID)) Assert.assertEquals(response.getHeader(AUConstants.X_V_HEADER).toInteger(), AUConstants.X_V_HEADER_CUSTOMER) Assert.assertNotNull(AUTestUtil.parseResponseBody(response, AUConstants.RESPONSE_DATA_CUSTOMERUTYPE)) @@ -76,7 +77,8 @@ class CustomerDetailsRetrievalTest extends AUTest { .get("${AUConstants.CUSTOMER_DETAILS}") Assert.assertEquals(response.statusCode(), AUConstants.STATUS_CODE_200) - Assert.assertNotNull(response.getHeader(AUConstants.X_FAPI_INTERACTION_ID)) + //TODO: Issue: https://github.com/wso2-enterprise/ob-compliance-toolkit-cds/issues/248 +// Assert.assertNotNull(response.getHeader(AUConstants.X_FAPI_INTERACTION_ID)) Assert.assertEquals(response.getHeader(AUConstants.X_V_HEADER).toInteger(), AUConstants.X_V_HEADER_CUSTOMER_DETAIL) Assert.assertNotNull(AUTestUtil.parseResponseBody(response, AUConstants.RESPONSE_DATA_CUSTOMERUTYPE)) diff --git a/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/integration/test/tpponboarding/CommonTppOnboardingStep.groovy b/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/integration/test/tpponboarding/CommonTppOnboardingStep.groovy index b920f3f76..4826ce63f 100644 --- a/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/integration/test/tpponboarding/CommonTppOnboardingStep.groovy +++ b/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/integration/test/tpponboarding/CommonTppOnboardingStep.groovy @@ -39,6 +39,7 @@ class CommonTppOnboardingStep extends AUTest{ @BeforeClass (alwaysRun = true) void "Delete Application if exists"() { + auConfiguration.setTppNumber(0) deleteApplicationIfExists() } diff --git a/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/keymanager/test/authorizationflow/AuthorisationFlowTest.groovy b/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/keymanager/test/authorizationflow/AuthorisationFlowTest.groovy index 435c6a473..cde3a485e 100644 --- a/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/keymanager/test/authorizationflow/AuthorisationFlowTest.groovy +++ b/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/keymanager/test/authorizationflow/AuthorisationFlowTest.groovy @@ -307,7 +307,7 @@ class AuthorisationFlowTest extends AUTest { .execute() def authUrl = automation.currentUrl.get() - Assert.assertTrue(AUTestUtil.getDecodedUrl(authUrl).contains(AUConstants.CANCEL_ERROR_IN_ACCOUNTS_PAGE)) + Assert.assertTrue(AUTestUtil.getDecodedUrl(authUrl).contains(AUConstants.USER_SKIP_THE_CONSENT_FLOW)) String stateParam = authUrl.split("state=")[1] Assert.assertEquals(auAuthorisationBuilder.state.toString(), stateParam) } @@ -517,8 +517,8 @@ class AuthorisationFlowTest extends AUTest { Assert.assertEquals(AUTestUtil.parseResponseBody(response, AUConstants.ERROR_DESCRIPTION), errorMessage) } - //Error - Not loading Profile Selection Page - @Test + //TODO: Issue: https://github.com/wso2-enterprise/ob-compliance-toolkit-cds/issues/411 + @Test (enabled = false) void "OB-1253_Initiate authorisation consent flow only with openid and profile scopes"() { scopes = [ diff --git a/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/keymanager/test/bnr/ConsentAmendmentFlowTests.groovy b/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/keymanager/test/bnr/ConsentAmendmentFlowTests.groovy index ce84fd10b..f992f20c3 100644 --- a/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/keymanager/test/bnr/ConsentAmendmentFlowTests.groovy +++ b/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/keymanager/test/bnr/ConsentAmendmentFlowTests.groovy @@ -89,7 +89,7 @@ class ConsentAmendmentFlowTests extends AUTest { //Consent Amendment scopes.remove(AUAccountScope.BANK_TRANSACTION_READ) - response = auAuthorisationBuilder.doPushAuthorisationRequest(scopes, AUConstants.DEFAULT_SHARING_DURATION, + response = auAuthorisationBuilder.doPushAuthorisationRequest(scopes, AUConstants.AMENDED_SHARING_DURATION, true, cdrArrangementId) requestUri = AUTestUtil.parseResponseBody(response, AUConstants.REQUEST_URI) authoriseUrl = auAuthorisationBuilder.getAuthorizationRequest(requestUri.toURI()).toURI().toString() @@ -104,8 +104,7 @@ class ConsentAmendmentFlowTests extends AUTest { if (auConfiguration.getProfileSelectionEnabled()) { //Verify Account Selection Page - assert authWebDriver.isElementDisplayed(AUTestUtil.getBusinessAccount3CheckBox()) - authWebDriver.clickButtonXpath(AUTestUtil.getBusinessAccount3CheckBox()) + assert authWebDriver.isElementSelected(AUTestUtil.getBusinessAccount2CheckBox()) } else { assert authWebDriver.isElementDisplayed(AUTestUtil.getSingleAccountXPath()) @@ -122,7 +121,7 @@ class ConsentAmendmentFlowTests extends AUTest { response = auAuthorisationBuilder.doPushAuthorisationRequest(scopes, AUConstants.DEFAULT_SHARING_DURATION, true, "") requestUri = AUTestUtil.parseResponseBody(response, AUConstants.REQUEST_URI) - doConsentAuthorisationViaRequestUriSingleAccount(scopes, requestUri.toURI(), null, AUAccountProfile.ORGANIZATION_A) + doConsentAuthorisationViaRequestUriSingleAccount(scopes, requestUri.toURI(), null, AUAccountProfile.ORGANIZATION_B) //Get Access Token AccessTokenResponse responseBody = getUserAccessTokenResponse(clientId) @@ -133,7 +132,7 @@ class ConsentAmendmentFlowTests extends AUTest { //Consent Amendment scopes.remove(AUAccountScope.BANK_TRANSACTION_READ) - response = auAuthorisationBuilder.doPushAuthorisationRequest(scopes, AUConstants.DEFAULT_SHARING_DURATION, + response = auAuthorisationBuilder.doPushAuthorisationRequest(scopes, AUConstants.AMENDED_SHARING_DURATION, true, cdrArrangementId) requestUri = AUTestUtil.parseResponseBody(response, AUConstants.REQUEST_URI) authoriseUrl = auAuthorisationBuilder.getAuthorizationRequest(requestUri.toURI()).toURI().toString() @@ -169,6 +168,7 @@ class ConsentAmendmentFlowTests extends AUTest { void "CDS-514_Verify a Consent Amendment flow with a Business user account"() { //Consent Authorisation + auConfiguration.setPsuNumber(0) response = auAuthorisationBuilder.doPushAuthorisationRequest(scopes, AUConstants.DEFAULT_SHARING_DURATION, true, "") requestUri = AUTestUtil.parseResponseBody(response, AUConstants.REQUEST_URI) @@ -195,7 +195,7 @@ class ConsentAmendmentFlowTests extends AUTest { //Consent Amendment scopes.remove(AUAccountScope.BANK_ACCOUNT_DETAIL_READ) - response = auAuthorisationBuilder.doPushAuthorisationRequest(scopes, AUConstants.DEFAULT_SHARING_DURATION, + response = auAuthorisationBuilder.doPushAuthorisationRequest(scopes, AUConstants.AMENDED_SHARING_DURATION, true, cdrArrangementId) requestUri = AUTestUtil.parseResponseBody(response, AUConstants.REQUEST_URI) authoriseUrl = auAuthorisationBuilder.getAuthorizationRequest(requestUri.toURI()).toURI().toString() diff --git a/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/keymanager/test/bnr/ConsentAuthFlowValidationTests.groovy b/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/keymanager/test/bnr/ConsentAuthFlowValidationTests.groovy index 556df7fac..2efd6b802 100644 --- a/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/keymanager/test/bnr/ConsentAuthFlowValidationTests.groovy +++ b/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/keymanager/test/bnr/ConsentAuthFlowValidationTests.groovy @@ -476,7 +476,7 @@ class ConsentAuthFlowValidationTests extends AUTest{ @Test (priority = 1) void "CDS-541_Verify same user nominated for multiple accounts"() { - auConfiguration.setPsuNumber(2) + auConfiguration.setPsuNumber(3) //Get Authorisation URL response = auAuthorisationBuilder.doPushAuthorisationRequest(scopes, AUConstants.DEFAULT_SHARING_DURATION, true, "") diff --git a/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/keymanager/test/bnr/UserNominationManagementTests.groovy b/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/keymanager/test/bnr/UserNominationManagementTests.groovy index e79a0d1cb..05a6ca5ac 100644 --- a/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/keymanager/test/bnr/UserNominationManagementTests.groovy +++ b/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/keymanager/test/bnr/UserNominationManagementTests.groovy @@ -302,7 +302,7 @@ class UserNominationManagementTests extends AUTest { Assert.assertEquals(deleteResponse.statusCode(), AUConstants.OK) } - @Test + @Test (priority = 1) void "CDS-600_Verify the Delete BU end point with NR who has REVOKE Permission"() { def shareableElements = AUTestUtil.getSharableAccountsList(getSharableBankAccounts()) diff --git a/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/keymanager/test/doms/DisclosureOptionManagementServiceTest.groovy b/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/keymanager/test/doms/DisclosureOptionManagementServiceTest.groovy index 6893d37f3..fe67e0490 100644 --- a/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/keymanager/test/doms/DisclosureOptionManagementServiceTest.groovy +++ b/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/keymanager/test/doms/DisclosureOptionManagementServiceTest.groovy @@ -350,7 +350,7 @@ class DisclosureOptionManagementServiceTest extends AUTest { Assert.assertEquals(response.statusCode(), AUConstants.STATUS_CODE_200) } - @Test + @Test(priority = 2) void "CDS-650_Verify Consent amendment flow after changing DOMS status to no-sharing"() { //Consent Authorisation diff --git a/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/keymanager/test/secondaryUser/CeasingSecondaryUserConsentFlowTest.groovy b/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/keymanager/test/secondaryUser/CeasingSecondaryUserConsentFlowTest.groovy index 508ab4f6e..f148fb799 100644 --- a/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/keymanager/test/secondaryUser/CeasingSecondaryUserConsentFlowTest.groovy +++ b/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/keymanager/test/secondaryUser/CeasingSecondaryUserConsentFlowTest.groovy @@ -106,7 +106,7 @@ class CeasingSecondaryUserConsentFlowTest extends AUTest { void "CDS-644_Verify account is not listed under unavailable accounts once the legal entity is active by account owner"() { //Active the sharing status - response = updateLegalEntityStatus(clientHeader, accountID, userId, legalEntityId, AUConstants.ACTIVE) + response = updateLegalEntityStatus(clientHeader, accountID, userId, legalEntityId.toLowerCase(), AUConstants.ACTIVE) Assert.assertEquals(response.statusCode(), AUConstants.STATUS_CODE_200) //Send Push Authorisation Request @@ -163,7 +163,7 @@ class CeasingSecondaryUserConsentFlowTest extends AUTest { void "CDS-646_Retrieve accounts after activating the data sharing for legal entity"() { //Block the sharing status - response = updateLegalEntityStatus(clientHeader, accountID, userId, legalEntityId, AUConstants.ACTIVE) + response = updateLegalEntityStatus(clientHeader, accountID, userId, legalEntityId.toLowerCase(), AUConstants.ACTIVE) Assert.assertEquals(response.statusCode(), AUConstants.STATUS_CODE_200) //Account Retrieval @@ -185,7 +185,7 @@ class CeasingSecondaryUserConsentFlowTest extends AUTest { def updateResponse = updateSecondaryUserInstructionPermission(altAccountID, userId, AUConstants.ACTIVE) Assert.assertEquals(updateResponse.statusCode(), AUConstants.OK) - response = updateLegalEntityStatus(clientHeader, altAccountID, userId, legalEntityId, AUConstants.ACTIVE) + response = updateLegalEntityStatus(clientHeader, altAccountID, userId, legalEntityId.toLowerCase(), AUConstants.ACTIVE) Assert.assertEquals(response.statusCode(), AUConstants.STATUS_CODE_200) //Send Push Authorisation Request @@ -236,7 +236,7 @@ class CeasingSecondaryUserConsentFlowTest extends AUTest { void "CDS-647_Consent amendment after ceasing the secondary user sharing"() { //Active the sharing status for secondary account 1 - response = updateLegalEntityStatus(clientHeader, accountID, userId, legalEntityId, AUConstants.ACTIVE) + response = updateLegalEntityStatus(clientHeader, accountID, userId, legalEntityId.toLowerCase(), AUConstants.ACTIVE) Assert.assertEquals(response.statusCode(), AUConstants.STATUS_CODE_200) //Send Push Authorisation Request @@ -299,7 +299,7 @@ class CeasingSecondaryUserConsentFlowTest extends AUTest { void "CDS-649_Verify account is listed under unavailable accounts once the legal entity is restricted in consent amendment flow"() { //Active the sharing status for secondary account 1 - response = updateLegalEntityStatus(clientHeader, accountID, userId, legalEntityId, AUConstants.ACTIVE) + response = updateLegalEntityStatus(clientHeader, accountID, userId, legalEntityId.toLowerCase(), AUConstants.ACTIVE) Assert.assertEquals(response.statusCode(), AUConstants.STATUS_CODE_200) //Send Push Authorisation Request diff --git a/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/keymanager/test/secondaryUser/CeasingSecondaryUserManagementTest.groovy b/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/keymanager/test/secondaryUser/CeasingSecondaryUserManagementTest.groovy index be620feea..a06b0f41a 100644 --- a/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/keymanager/test/secondaryUser/CeasingSecondaryUserManagementTest.groovy +++ b/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/keymanager/test/secondaryUser/CeasingSecondaryUserManagementTest.groovy @@ -74,7 +74,7 @@ class CeasingSecondaryUserManagementTest extends AUTest { @Test (groups = "SmokeTest", priority = 1) void "CDS-631_Block the sharing status for a legal entity"() { - response = updateLegalEntityStatus(clientHeader, accountID, userId, legalEntityId, AUConstants.BLOCK_ENTITY) + response = updateLegalEntityStatus(clientHeader, accountID, userId, legalEntityId.toLowerCase(), AUConstants.BLOCK_ENTITY) Assert.assertEquals(response.statusCode(), AUConstants.STATUS_CODE_200) //Check Sharing Status @@ -86,7 +86,7 @@ class CeasingSecondaryUserManagementTest extends AUTest { @Test (priority = 1, dependsOnMethods = "CDS-631_Block the sharing status for a legal entity") void "CDS-632_Block an already blocked legal entity"() { - response = updateLegalEntityStatus(clientHeader, accountID, userId, legalEntityId, AUConstants.BLOCK_ENTITY) + response = updateLegalEntityStatus(clientHeader, accountID, userId, legalEntityId.toLowerCase(), AUConstants.BLOCK_ENTITY) Assert.assertEquals(response.statusCode(), AUConstants.STATUS_CODE_200) //Check Sharing Status @@ -98,7 +98,7 @@ class CeasingSecondaryUserManagementTest extends AUTest { @Test (priority = 1, dependsOnMethods = "CDS-632_Block an already blocked legal entity") void "CDS-633_Unlock the sharing status for a legal entity"() { - response = updateLegalEntityStatus(clientHeader, accountID, userId, legalEntityId, AUConstants.ACTIVE) + response = updateLegalEntityStatus(clientHeader, accountID, userId, legalEntityId.toLowerCase(), AUConstants.ACTIVE) Assert.assertEquals(response.statusCode(), AUConstants.STATUS_CODE_200) //Check Sharing Status @@ -123,7 +123,7 @@ class CeasingSecondaryUserManagementTest extends AUTest { @Test void "CDS-635_Block sharing status with incorrect status value"() { - response = updateLegalEntityStatus(clientHeader, accountID, userId, legalEntityId, "Block_Entity") + response = updateLegalEntityStatus(clientHeader, accountID, userId, legalEntityId.toLowerCase(), "Block_Entity") Assert.assertEquals(response.statusCode(), AUConstants.STATUS_CODE_400) //TODO: Issue: https://github.com/wso2-enterprise/financial-open-banking/issues/8275 @@ -135,16 +135,16 @@ class CeasingSecondaryUserManagementTest extends AUTest { @Test void "CDS-639_Block sharing status for multiple user Ids"() { - response = updateLegalEntityStatus(clientHeader, accountID, userId, legalEntityId, AUConstants.BLOCK_ENTITY, - true, "admin@wso2.com", accountID, altLegalEntityId, AUConstants.BLOCK_ENTITY) + response = updateLegalEntityStatus(clientHeader, accountID, userId, legalEntityId.toLowerCase(), AUConstants.BLOCK_ENTITY, + true, "admin@wso2.com", accountID, altLegalEntityId.toLowerCase(), AUConstants.BLOCK_ENTITY) Assert.assertEquals(response.statusCode(), AUConstants.STATUS_CODE_200) } @Test void "CDS-640_Blocking and activating sharing status for legal entities via same request"() { - response = updateLegalEntityStatus(clientHeader, accountID, userId, legalEntityId, AUConstants.ACTIVE, - true, userId, accountID, altLegalEntityId, AUConstants.BLOCK_ENTITY) + response = updateLegalEntityStatus(clientHeader, accountID, userId, legalEntityId.toLowerCase(), AUConstants.ACTIVE, + true, userId, accountID, altLegalEntityId.toLowerCase(), AUConstants.BLOCK_ENTITY) Assert.assertEquals(response.statusCode(), AUConstants.STATUS_CODE_200) } @@ -194,6 +194,4 @@ class CeasingSecondaryUserManagementTest extends AUTest { "Error occurred while updating the sharing status for a legal entity/entities.") Assert.assertEquals(AUTestUtil.parseResponseBody(response, AUConstants.ERROR), AUConstants.INVALID_REQUEST) } - - } diff --git a/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/preexecution/CreateCustomKeyManagerTest.groovy b/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/preexecution/CreateCustomKeyManagerTest.groovy new file mode 100644 index 000000000..b39eeb037 --- /dev/null +++ b/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/preexecution/CreateCustomKeyManagerTest.groovy @@ -0,0 +1,60 @@ +/** + * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.cds.preexecution + +import org.testng.annotations.BeforeClass +import org.testng.annotations.Test +import org.wso2.cds.test.framework.configuration.AUConfigurationService +import org.wso2.cds.test.framework.request_builder.RESTKeyManagerRequestBuilder +import org.wso2.cds.test.framework.utility.AURestAsRequestBuilder + +import java.util.logging.Logger + +/** + * Test class to contain steps to create OB Custom Key Manager. + */ +class CreateCustomKeyManagerTest { + + AUConfigurationService auConfiguration = new AUConfigurationService() + + Logger log = Logger.getLogger(CreateCustomKeyManagerTest.class.toString()) + String gatewayUrl = auConfiguration.getServerGatewayURL() + String accessToken + + @BeforeClass (alwaysRun = true) + void checkProvisioning() { + AURestAsRequestBuilder.init() + } + + /** + * Steps to Create OB Key Manager. + */ + @Test (groups = "SmokeTest") + void "Create OB KeyManager"() { + RESTKeyManagerRequestBuilder keyManagerGeneration = new RESTKeyManagerRequestBuilder() + keyManagerGeneration.createDCRApplication() + accessToken = keyManagerGeneration.obtainAccessToken() + keyManagerGeneration.getResidentKeyManager(accessToken) + keyManagerGeneration.disableResidentKeyManager(accessToken) + //Adding sleep to fix an intermittent issue related to loading of key manager configurations. + sleep(5000) + keyManagerGeneration.addKeyManager(accessToken) + sleep(5000) + } +} diff --git a/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/preexecution/PublishAndSubscribeApiTest.groovy b/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/preexecution/PublishAndSubscribeApiTest.groovy new file mode 100644 index 000000000..cb0d15927 --- /dev/null +++ b/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/preexecution/PublishAndSubscribeApiTest.groovy @@ -0,0 +1,64 @@ +/** + * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.cds.preexecution + +import org.testng.SkipException +import org.testng.annotations.BeforeClass +import org.testng.annotations.Test +import org.wso2.cds.test.framework.AUTest +import org.wso2.cds.test.framework.configuration.AUConfigurationService +import org.wso2.cds.test.framework.request_builder.RESTApiAccessTokenGeneration +import org.wso2.cds.test.framework.request_builder.RESTApiPublishRequestBuilder +import org.wso2.cds.test.framework.utility.AURestAsRequestBuilder + +import java.util.logging.Logger + +/** + * Test class to contain Api Publishing and Subscribing scenarios + */ +class PublishAndSubscribeApiTest extends AUTest{ + + AUConfigurationService auConfiguration = new AUConfigurationService() + Logger log = Logger.getLogger(PublishAndSubscribeApiTest.class.toString()) + String gatewayUrl = auConfiguration.getServerGatewayURL() + String accessToken + List apiIDs + + @BeforeClass (alwaysRun = true) + void checkProvisioning() { + AURestAsRequestBuilder.init() + if (!auConfiguration.isProvisioning()) { + throw new SkipException("Skipping API provisioning because the config set to false.") + } + } + + @Test (groups = "SmokeTest") + void "Publish Api"() { + RESTApiAccessTokenGeneration accessTokenGeneration = new RESTApiAccessTokenGeneration() + accessTokenGeneration.createDCRApplication() + accessToken = accessTokenGeneration.obtainAccessToken() + + RESTApiPublishRequestBuilder requestBuilder = new RESTApiPublishRequestBuilder() + apiIDs = requestBuilder.createAPIs(accessToken) + requestBuilder.addPolicy(accessToken, apiIDs) + requestBuilder.createRevision(accessToken, apiIDs) + requestBuilder.deployRevision(accessToken, apiIDs) + requestBuilder.publishAPI(accessToken, apiIDs) + } +} diff --git a/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/preexecution/UserCreationTest.groovy b/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/preexecution/UserCreationTest.groovy new file mode 100644 index 000000000..b22d097c0 --- /dev/null +++ b/integration-test-suite/cds-toolkit-integration-test/src/test/groovy/org/wso2/cds/preexecution/UserCreationTest.groovy @@ -0,0 +1,97 @@ +/** + * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.cds.preexecution + +import com.nimbusds.oauth2.sdk.http.HTTPResponse +import org.testng.Assert +import org.testng.annotations.Test +import org.wso2.cds.test.framework.AUTest +import org.wso2.cds.test.framework.constant.AUConstants +import org.wso2.cds.test.framework.request_builder.RESTApiUserCreationRequestBuilder + +import org.wso2.cds.test.framework.utility.AUTestUtil + +import java.util.logging.Logger + +/** + * Test class to contain steps to create Test Users. + */ +class UserCreationTest extends AUTest { + + String userId + String roleId + String userName + String password + String roleName + RESTApiUserCreationRequestBuilder restApiUserCreationRequestBuilder + Logger log = Logger.getLogger(UserCreationTest.class.toString()) + List> userInfoList + + @Test (groups = "SmokeTest") + void "Create PSU"() { + + userInfoList = new ArrayList<>() + + for (int i = 0; i < 5; i++) { + + auConfiguration.setPsuNumber(i) + userName = auConfiguration.getUserPSUName() + password = auConfiguration.getUserPSUPWD() + + restApiUserCreationRequestBuilder = new RESTApiUserCreationRequestBuilder() + + if (!userName.equalsIgnoreCase(auConfiguration.getUserKeyManagerAdminName())) { + def createUserResponse = restApiUserCreationRequestBuilder.createUser(userName, password) + Assert.assertEquals(createUserResponse.statusCode(), HTTPResponse.SC_CREATED) + userId = AUTestUtil.parseResponseBody(createUserResponse, "id") + Assert.assertNotNull(userId) + } else { + userId = restApiUserCreationRequestBuilder.getAdminUserId() + } + + Map userInfo = new HashMap<>() + userInfo.put("UserId", userId) + userInfo.put("Username", userName) + userInfoList.add(userInfo) + } + } + + @Test (dependsOnMethods = ["Create PSU"], groups = "SmokeTest") + void "Assign Subscriber Role to the user"() { + + if (!userName.equalsIgnoreCase(auConfiguration.getUserKeyManagerAdminName())) { + roleName = AUConstants.SUBSCRIBER_ROLE + + //Get Internal/subscriber role Id + roleId = restApiUserCreationRequestBuilder.getRoleId(roleName) + + //Assign subscriber role to the created user + def response = restApiUserCreationRequestBuilder.assignUserRoles(roleName, roleId, userInfoList) + + Assert.assertEquals(response.statusCode(), HTTPResponse.SC_OK) + + //Verify Assigned User Role + def responseUserRole = restApiUserCreationRequestBuilder.getUserDetails(userId) + + Assert.assertEquals(responseUserRole.statusCode(), HTTPResponse.SC_OK) + Assert.assertTrue(AUTestUtil.parseResponseBody(responseUserRole, "roles[0].value") + .contains(roleId)) + } + } +} diff --git a/integration-test-suite/cds-toolkit-integration-test/src/test/resources/testng.xml b/integration-test-suite/cds-toolkit-integration-test/src/test/resources/testng.xml index c2d40de96..14284345a 100644 --- a/integration-test-suite/cds-toolkit-integration-test/src/test/resources/testng.xml +++ b/integration-test-suite/cds-toolkit-integration-test/src/test/resources/testng.xml @@ -19,30 +19,62 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + - + + + + + + + - + @@ -54,12 +86,12 @@ - + - + @@ -93,7 +125,6 @@ - @@ -163,7 +195,8 @@ - + + diff --git a/integration-test-suite/cds-toolkit-integration-test/src/test/resources/testngSmokeTest.xml b/integration-test-suite/cds-toolkit-integration-test/src/test/resources/testngSmokeTest.xml index 4436581da..24148a521 100644 --- a/integration-test-suite/cds-toolkit-integration-test/src/test/resources/testngSmokeTest.xml +++ b/integration-test-suite/cds-toolkit-integration-test/src/test/resources/testngSmokeTest.xml @@ -19,7 +19,49 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -107,7 +188,7 @@ - +