-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #97 from ELEVATE-Project/GetReviewerBranch
added GetReviewerList api script
- Loading branch information
Showing
6 changed files
with
70 additions
and
99 deletions.
There are no files selected for viewing
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
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
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
96 changes: 0 additions & 96 deletions
96
src/test/java/org/shikshalokam/backend/ep/TestCRUDUserRoleExtension.java
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -139,3 +139,4 @@ private Response findUserRoleExtension() { | |
return response; | ||
} | ||
} | ||
|
60 changes: 60 additions & 0 deletions
60
src/test/java/org/shikshalokam/backend/scp/TestGetReviewerList.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,60 @@ | ||
package org.shikshalokam.backend.scp; | ||
|
||
import static io.restassured.RestAssured.given; | ||
import static org.shikshalokam.backend.PropertyLoader.*; | ||
import static org.testng.Assert.*; | ||
|
||
import io.restassured.response.Response; | ||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
import org.testng.annotations.BeforeTest; | ||
import org.testng.annotations.Test; | ||
|
||
import java.net.URI; | ||
import java.net.URISyntaxException; | ||
|
||
public class TestGetReviewerList extends SelfCreationPortalBaseTest { | ||
private static final Logger logger = LogManager.getLogger(TestGetReviewerList.class); | ||
|
||
@BeforeTest | ||
public void init() { | ||
logger.info("Logging into the application:"); | ||
loginToScp( | ||
PROP_LIST.get("scp.getreviewer.id").toString(), | ||
PROP_LIST.get("scp.getreviewer.pass").toString() | ||
); | ||
} | ||
|
||
@Test | ||
public void testGetReviewerList() { | ||
logger.info("Started calling the reviewerList API:"); | ||
URI endpoint; | ||
try { | ||
endpoint = new URI("https://scp-qa.elevate-apis.shikshalokam.org/scp/v1/projects/reviewerList"); | ||
} catch (URISyntaxException e) { | ||
throw new RuntimeException("Error constructing URI for reviewerList API", e); | ||
} | ||
|
||
Response response = given() | ||
.header("X-auth-token", "bearer " + X_AUTH_TOKEN) | ||
.when() | ||
.get(endpoint); | ||
|
||
assertEquals(response.getStatusCode(), 200, "Status code failed for fetching reviewerList"); | ||
|
||
String responseBody = response.getBody().asString(); | ||
logger.info("Response: " + responseBody); | ||
|
||
// Retrieve the expected email from the properties file with a null check | ||
String expectedEmail = PROP_LIST.getProperty("scp.getreviewer.list.verify"); | ||
if (expectedEmail == null) { | ||
throw new RuntimeException("Property 'scp.getreviewer.list.verify' is missing in the properties file."); | ||
} | ||
|
||
// Verify if the response contains the expected email | ||
assertTrue(responseBody.contains(expectedEmail), | ||
"Expected email '" + expectedEmail + "' not found in the response."); | ||
|
||
logger.info("Verified that the expected email '" + expectedEmail + "' is present in the response."); | ||
} | ||
} |