Skip to content

Commit

Permalink
Merge pull request #20903 from Shenali-SJ/actions-integration-tests
Browse files Browse the repository at this point in the history
[integration tests] Pre issues access token action with password grant type
  • Loading branch information
malithie committed Aug 29, 2024
2 parents 9b1a1f6 + b6b9f89 commit 3c5f8cb
Show file tree
Hide file tree
Showing 11 changed files with 1,216 additions and 1 deletion.
5 changes: 5 additions & 0 deletions modules/integration/tests-integration/tests-backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,11 @@
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<dependency>
<groupId>org.wiremock</groupId>
<artifactId>wiremock</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/*
* Copyright (c) 2024, WSO2 LLC. (http://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.identity.integration.test.actions;

import org.wso2.carbon.automation.engine.context.TestUserMode;
import org.wso2.identity.integration.test.oauth2.OAuth2ServiceAbstractIntegrationTest;
import org.wso2.identity.integration.test.rest.api.server.action.management.v1.model.ActionModel;
import org.wso2.identity.integration.test.restclients.ActionsRestClient;

import java.io.IOException;

/**
* Base test case for action-related tests.
* This class extends {@link OAuth2ServiceAbstractIntegrationTest} and provides the necessary setup
* and utility methods for testing actions via the {@link ActionsRestClient}.
*/
public class ActionsBaseTestCase extends OAuth2ServiceAbstractIntegrationTest {

protected ActionsRestClient restClient;

/**
* Initialize the test case.
*
* @param userMode User Mode
* @throws Exception If an error occurred while initializing the clients.
*/
protected void init(TestUserMode userMode) throws Exception {

super.init(userMode);

restClient = new ActionsRestClient(serverURL, tenantInfo);

setSystemproperties();
}

/**
* Create action of different types.
*
* @param actionType Type of action
* @param actionModel Request object to create the action
* @return Status code of the action creation
* @throws IOException If an error occurred while creating the action
*/
public String createAction(String actionType, ActionModel actionModel) throws IOException {

return restClient.createActionType(actionModel, actionType);
}

/**
* Delete an action.
*
* @param actionType Type of action
* @param actionId ID of the action
* @return Status code of the action creation
* @throws IOException If an error occurred while deleting the action
*/
public int deleteAction(String actionType, String actionId) throws IOException {

return restClient.deleteActionType(actionType, actionId);
}
}
Loading

0 comments on commit 3c5f8cb

Please sign in to comment.