Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Test Suite] - Automate Test Suite Execution Flow #63

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class DynamicClientRegistrationCreateTest extends AUTest{

@BeforeClass (alwaysRun = true)
void "Delete Application if exists"() {
auConfiguration.setTppNumber(1)
deleteApplicationIfExists(auConfiguration.getAppInfoClientID())
softwareId = "SP1"
}
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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())
Expand All @@ -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())
Expand All @@ -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"),
Expand Down Expand Up @@ -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()
Expand All @@ -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)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -100,4 +101,9 @@ class DynamicClientRegistrationDeleteTest extends AUTest {

Assert.assertEquals(registrationResponse.statusCode(), AUConstants.STATUS_CODE_501)
}

@AfterClass
void "Clean up"() {
deleteApplicationIfExists(clientId)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -77,4 +78,9 @@ class DynamicClientRegistrationRetrieveTest extends AUTest{

Assert.assertEquals(registrationResponse.statusCode(), AUConstants.STATUS_CODE_200)
}

@AfterClass
void "Clean up"() {
deleteApplicationIfExists(clientId)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -236,4 +237,9 @@ class DynamicClientRegistrationUpdateTest extends AUTest{

Assert.assertEquals(registrationResponse.statusCode(), AUConstants.STATUS_CODE_501)
}

@AfterClass
void "Clean up"() {
deleteApplicationIfExists(clientId)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
Loading
Loading