-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MOSIP-37857 Partner Admin API automation (#1041)
* MOSIP-37857 with correct branch merged * MOSIP-37857 Signed-off-by: Sohan Kumar Dey <[email protected]> * MOSIP-37857 Signed-off-by: Sohan Kumar Dey <[email protected]> * MOSIP-37857 Signed-off-by: Sohan Kumar Dey <[email protected]> * MOSIP-37857 Signed-off-by: Sohan Kumar Dey <[email protected]> * Delete et --soft d2d5be7e Signed-off-by: Sohan Kumar Dey <[email protected]> --------- Signed-off-by: Sohan Kumar Dey <[email protected]>
- Loading branch information
Showing
40 changed files
with
511 additions
and
5 deletions.
There are no files selected for viewing
141 changes: 141 additions & 0 deletions
141
api-test/src/main/java/io/mosip/testrig/apirig/testscripts/PatchWithPathParam.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
package io.mosip.testrig.apirig.testscripts; | ||
|
||
import java.lang.reflect.Field; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import org.apache.log4j.Level; | ||
import org.apache.log4j.Logger; | ||
import org.json.JSONObject; | ||
import org.testng.ITest; | ||
import org.testng.ITestContext; | ||
import org.testng.ITestResult; | ||
import org.testng.Reporter; | ||
import org.testng.SkipException; | ||
import org.testng.annotations.AfterMethod; | ||
import org.testng.annotations.BeforeClass; | ||
import org.testng.annotations.DataProvider; | ||
import org.testng.annotations.Test; | ||
import org.testng.internal.BaseTestMethod; | ||
import org.testng.internal.TestResult; | ||
|
||
import io.mosip.testrig.apirig.dto.OutputValidationDto; | ||
import io.mosip.testrig.apirig.dto.TestCaseDTO; | ||
import io.mosip.testrig.apirig.testrunner.HealthChecker; | ||
import io.mosip.testrig.apirig.utils.AdminTestException; | ||
import io.mosip.testrig.apirig.utils.AdminTestUtil; | ||
import io.mosip.testrig.apirig.utils.AuthenticationTestException; | ||
import io.mosip.testrig.apirig.utils.ConfigManager; | ||
import io.mosip.testrig.apirig.utils.GlobalConstants; | ||
import io.mosip.testrig.apirig.utils.OutputValidationUtil; | ||
import io.mosip.testrig.apirig.utils.ReportUtil; | ||
import io.restassured.response.Response; | ||
|
||
public class PatchWithPathParam extends AdminTestUtil implements ITest { | ||
private static final Logger logger = Logger.getLogger(PatchWithPathParam.class); | ||
protected String testCaseName = ""; | ||
public Response response = null; | ||
|
||
@BeforeClass | ||
public static void setLogLevel() { | ||
if (ConfigManager.IsDebugEnabled()) | ||
logger.setLevel(Level.ALL); | ||
else | ||
logger.setLevel(Level.ERROR); | ||
} | ||
|
||
/** | ||
* get current testcaseName | ||
*/ | ||
@Override | ||
public String getTestName() { | ||
return testCaseName; | ||
} | ||
|
||
/** | ||
* Data provider class provides test case list | ||
* | ||
* @return object of data provider | ||
*/ | ||
@DataProvider(name = "testcaselist") | ||
public Object[] getTestCaseList(ITestContext context) { | ||
String ymlFile = context.getCurrentXmlTest().getLocalParameters().get("ymlFile"); | ||
logger.info("Started executing yml: " + ymlFile); | ||
return getYmlTestData(ymlFile); | ||
} | ||
|
||
/** | ||
* Test method for OTP Generation execution | ||
* | ||
* @param objTestParameters | ||
* @param testScenario | ||
* @param testcaseName | ||
* @throws AuthenticationTestException | ||
* @throws AdminTestException | ||
*/ | ||
@Test(dataProvider = "testcaselist") | ||
public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, AdminTestException { | ||
testCaseName = testCaseDTO.getTestCaseName(); | ||
if (HealthChecker.signalTerminateExecution) { | ||
throw new SkipException( | ||
GlobalConstants.TARGET_ENV_HEALTH_CHECK_FAILED + HealthChecker.healthCheckFailureMapS); | ||
} | ||
|
||
|
||
String[] templateFields = testCaseDTO.getTemplateFields(); | ||
|
||
if (testCaseDTO.getTemplateFields() != null && templateFields.length > 0) { | ||
ArrayList<JSONObject> inputtestCases = AdminTestUtil.getInputTestCase(testCaseDTO); | ||
ArrayList<JSONObject> outputtestcase = AdminTestUtil.getOutputTestCase(testCaseDTO); | ||
for (int i = 0; i < languageList.size(); i++) { | ||
response = patchWithPathParamAndCookie(ApplnURI + testCaseDTO.getEndPoint(), | ||
getJsonFromTemplate(inputtestCases.get(i).toString(), testCaseDTO.getInputTemplate()), | ||
COOKIENAME, testCaseDTO.getRole(), testCaseDTO.getTestCaseName()); | ||
|
||
Map<String, List<OutputValidationDto>> ouputValid = OutputValidationUtil.doJsonOutputValidation( | ||
response.asString(), | ||
getJsonFromTemplate(outputtestcase.get(i).toString(), testCaseDTO.getOutputTemplate()), | ||
testCaseDTO, response.getStatusCode()); | ||
Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); | ||
|
||
if (!OutputValidationUtil.publishOutputResult(ouputValid)) | ||
throw new AdminTestException("Failed at output validation"); | ||
} | ||
} | ||
|
||
else { | ||
response = patchWithPathParamAndCookie(ApplnURI + testCaseDTO.getEndPoint(), | ||
getJsonFromTemplate(testCaseDTO.getInput(), testCaseDTO.getInputTemplate()), COOKIENAME, | ||
testCaseDTO.getRole(), testCaseDTO.getTestCaseName()); | ||
|
||
Map<String, List<OutputValidationDto>> ouputValid = OutputValidationUtil.doJsonOutputValidation( | ||
response.asString(), getJsonFromTemplate(testCaseDTO.getOutput(), testCaseDTO.getOutputTemplate()), | ||
testCaseDTO, response.getStatusCode()); | ||
Reporter.log(ReportUtil.getOutputValidationReport(ouputValid)); | ||
|
||
if (!OutputValidationUtil.publishOutputResult(ouputValid)) | ||
throw new AdminTestException("Failed at output validation"); | ||
} | ||
} | ||
|
||
/** | ||
* The method ser current test name to result | ||
* | ||
* @param result | ||
*/ | ||
@AfterMethod(alwaysRun = true) | ||
public void setResultTestName(ITestResult result) { | ||
try { | ||
Field method = TestResult.class.getDeclaredField("m_method"); | ||
method.setAccessible(true); | ||
method.set(result, result.getMethod().clone()); | ||
BaseTestMethod baseTestMethod = (BaseTestMethod) result.getMethod(); | ||
Field f = baseTestMethod.getClass().getSuperclass().getDeclaredField("m_methodName"); | ||
f.setAccessible(true); | ||
f.set(baseTestMethod, testCaseName); | ||
} catch (Exception e) { | ||
Reporter.log("Exception : " + e.getMessage()); | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
api-test/src/main/resources/pms/DeactivatePolicyGroup/DeactivatePolicyGroup.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
DeactivatePolicyGroup: | ||
Pms_DeactivatePolicyGroup_All_Valid_Smoke: | ||
endPoint: /v1/policymanager/policies/group/{policyGroupId} | ||
description: Deactivate Policy Groups | ||
role: partnerrevamp | ||
checkErrorsOnlyInResponse: true | ||
restMethod: get | ||
inputTemplate: pms/DeactivatePolicyGroup/deactivatePolicyGroup | ||
outputTemplate: pms/DeactivatePolicyGroup/deactivatePolicyGroupResult | ||
input: '{ | ||
"policyGroupId": "$ID:DefinePolicyGroup_create_then_deactivate_sid_id$" | ||
}' | ||
output: ' { | ||
}' |
3 changes: 3 additions & 0 deletions
3
api-test/src/main/resources/pms/DeactivatePolicyGroup/deactivatePolicyGroup.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"policyGroupId":"{{policyGroupId}}" | ||
} |
2 changes: 2 additions & 0 deletions
2
api-test/src/main/resources/pms/DeactivatePolicyGroup/deactivatePolicyGroupResult.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
api-test/src/main/resources/pms/GetAllOauthClient/GetAllOauthClient.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
GetAllOauthClient: | ||
Pms_GetAllOauthClient_All_Valid_Smoke: | ||
endPoint: /v1/partnermanager/oauth/partners/clients | ||
description: Fetching all OIDC Clients of the loggedin Partner | ||
role: partnerrevamp | ||
checkErrorsOnlyInResponse: true | ||
restMethod: get | ||
inputTemplate: pms/GetAllOauthClient/getAllOauthClient | ||
outputTemplate: pms/GetAllOauthClient/getAllOauthClientResult | ||
input: '{ | ||
}' | ||
output: '{ | ||
"errors": [ | ||
{ | ||
"errorCode": "PMS_CERTIFICATE_ERROR_002" | ||
} | ||
] | ||
}' |
35 changes: 35 additions & 0 deletions
35
api-test/src/main/resources/pms/GetAllOauthClient/GetAllOidcClientNegativeScenarios.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
GetAllOidcClient: | ||
Pms_GetAllOidcClient_without_Auth: | ||
endPoint: /v1/partnermanager/oauth/clients | ||
description: Fetching all OIDC Clients of the loggedin Partner | ||
role: batch | ||
checkErrorsOnlyInResponse: true | ||
restMethod: get | ||
inputTemplate: pms/GetAllOidcClient/getAllOidcClient | ||
outputTemplate: pms/GetAllOidcClient/getAllOidcClientResult | ||
input: '{ | ||
}' | ||
output: '{ | ||
"errors": [ | ||
{ | ||
"errorCode": "KER-ATH-401" | ||
} | ||
] | ||
}' | ||
Pms_GetAllOidcClient_Invalid_Auth: | ||
endPoint: /v1/partnermanager/oauth/clients | ||
description: Fetching all OIDC Clients of the loggedin Partner | ||
role: regproc | ||
checkErrorsOnlyInResponse: true | ||
restMethod: get | ||
inputTemplate: pms/GetAllOidcClient/getAllOidcClient | ||
outputTemplate: pms/GetAllOidcClient/getAllOidcClientResult | ||
input: '{ | ||
}' | ||
output: '{ | ||
"errors": [ | ||
{ | ||
"errorCode": "KER-ATH-403" | ||
} | ||
] | ||
}' |
2 changes: 2 additions & 0 deletions
2
api-test/src/main/resources/pms/GetAllOauthClient/getAllOauthClient.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{ | ||
} |
2 changes: 2 additions & 0 deletions
2
api-test/src/main/resources/pms/GetAllOauthClient/getAllOidcClientResult.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{ | ||
} |
13 changes: 13 additions & 0 deletions
13
api-test/src/main/resources/pms/GetAllPartnerPolicyRequest/GetAllPartnerPolicyRequest.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
GetAllPartnerPolicyRequest: | ||
Pms_GetAllPartnerPolicyRequest_All_Valid_Smoke: | ||
endPoint: /v1/partnermanager/partners/partner-policy-requests | ||
description: Fetching all the active Partnered PolicyGroups | ||
role: partnerrevamp | ||
checkErrorsOnlyInResponse: true | ||
restMethod: get | ||
inputTemplate: pms/GetAllPartnerPolicyRequest/getAllPartnerPolicyRequest | ||
outputTemplate: pms/GetAllPartnerPolicyRequest/getAllPartnerPolicyRequestResult | ||
input: '{ | ||
}' | ||
output: ' { | ||
}' |
2 changes: 2 additions & 0 deletions
2
api-test/src/main/resources/pms/GetAllPartnerPolicyRequest/getAllPartnerPolicyRequest.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{ | ||
} |
2 changes: 2 additions & 0 deletions
2
...st/src/main/resources/pms/GetAllPartnerPolicyRequest/getAllPartnerPolicyRequestResult.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{ | ||
} |
13 changes: 13 additions & 0 deletions
13
api-test/src/main/resources/pms/GetCountOfFtm/GetCountOfFtm.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
GetCountOfFtm: | ||
Pms_GetCountOfFtm_All_Valid_Smoke: | ||
endPoint: /v1/partnermanager/ftpchipdetail/search/v2 | ||
description: Fetching all active FTM | ||
role: partnerrevamp | ||
checkErrorsOnlyInResponse: true | ||
restMethod: get | ||
inputTemplate: pms/GetCountOfFtm/getCountOfFtm | ||
outputTemplate: pms/GetCountOfFtm/getCountOfFtmResult | ||
input: '{ | ||
}' | ||
output: ' { | ||
}' |
2 changes: 2 additions & 0 deletions
2
api-test/src/main/resources/pms/GetCountOfFtm/getCountOfFtm.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{ | ||
} |
2 changes: 2 additions & 0 deletions
2
api-test/src/main/resources/pms/GetCountOfFtm/getCountOfFtmResult.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{ | ||
} |
14 changes: 14 additions & 0 deletions
14
api-test/src/main/resources/pms/GetDetailsOfPartner/GetDetailsOfPartner.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
GetDetailsOfPartner: | ||
Pms_GetDetailsOfPartner_All_Valid_Smoke: | ||
endPoint: /v1/partnermanager/partners/{partnerId}/v2 | ||
description: Fetching all the details of the Partner Id | ||
role: partnerrevamp | ||
checkErrorsOnlyInResponse: true | ||
restMethod: get | ||
inputTemplate: pms/GetDetailsOfPartner/getDetailsOfPartner | ||
outputTemplate: pms/GetDetailsOfPartner/getDetailsOfPartnerResult | ||
input: '{ | ||
"partnerId": "111999" | ||
}' | ||
output: ' { | ||
}' |
3 changes: 3 additions & 0 deletions
3
api-test/src/main/resources/pms/GetDetailsOfPartner/getDetailsOfPartner.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"partnerId":"{{partnerId}}" | ||
} |
2 changes: 2 additions & 0 deletions
2
api-test/src/main/resources/pms/GetDetailsOfPartner/getDetailsOfPartnerResult.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{ | ||
} |
13 changes: 13 additions & 0 deletions
13
api-test/src/main/resources/pms/GetListOfAllDevice/GetListOfAllDevice.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
GetListOfAllDevice: | ||
Pms_GetListOfAllDevice_All_Valid_Smoke: | ||
endPoint: /v1/partnermanager/devicedetail/search/v2 | ||
description: Fetching all the active SBI | ||
role: partnerrevamp | ||
checkErrorsOnlyInResponse: true | ||
restMethod: get | ||
inputTemplate: pms/GetListOfAllDevice/getListOfAllDevice | ||
outputTemplate: pms/GetListOfAllDevice/getListOfAllDeviceResult | ||
input: '{ | ||
}' | ||
output: ' { | ||
}' |
2 changes: 2 additions & 0 deletions
2
api-test/src/main/resources/pms/GetListOfAllDevice/getListOfAllDevice.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{ | ||
} |
2 changes: 2 additions & 0 deletions
2
api-test/src/main/resources/pms/GetListOfAllDevice/getListOfAllDeviceResult.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{ | ||
} |
13 changes: 13 additions & 0 deletions
13
api-test/src/main/resources/pms/GetListOfAllSBI/GetListOfAllSBI.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
GetListOfAllSBI: | ||
Pms_GetListOfAllSBI_All_Valid_Smoke: | ||
endPoint: /v1/partnermanager/securebiometricinterface/search/v2 | ||
description: Fetching all the active SBI | ||
role: partnerrevamp | ||
checkErrorsOnlyInResponse: true | ||
restMethod: get | ||
inputTemplate: pms/GetListOfAllSBI/getListOfAllSBI | ||
outputTemplate: pms/GetListOfAllSBI/getListOfAllSBIResult | ||
input: '{ | ||
}' | ||
output: ' { | ||
}' |
2 changes: 2 additions & 0 deletions
2
api-test/src/main/resources/pms/GetListOfAllSBI/getListOfAllSBI.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{ | ||
} |
2 changes: 2 additions & 0 deletions
2
api-test/src/main/resources/pms/GetListOfAllSBI/getListOfAllSBIResult.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{ | ||
} |
Oops, something went wrong.