-
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 #50 from ProjectEKA/addcarecontext
[Haripriya] Add care context api test automation
- Loading branch information
Showing
6 changed files
with
106 additions
and
2 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
12 changes: 12 additions & 0 deletions
12
src/test/java/tests/apitests/gateway/models/addCareContext/AddCareContextPayLoad.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,12 @@ | ||
package tests.apitests.gateway.models.addCareContext; | ||
|
||
import lombok.Builder; | ||
import lombok.Data; | ||
|
||
@Data | ||
@Builder | ||
public class AddCareContextPayLoad { | ||
String requestId; | ||
String timestamp; | ||
Link link; | ||
} |
11 changes: 11 additions & 0 deletions
11
src/test/java/tests/apitests/gateway/models/addCareContext/CareContextAdd.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,11 @@ | ||
package tests.apitests.gateway.models.addCareContext; | ||
|
||
import lombok.Builder; | ||
import lombok.Data; | ||
|
||
@Data | ||
@Builder | ||
public class CareContextAdd { | ||
String referenceNumber; | ||
String display; | ||
} |
12 changes: 12 additions & 0 deletions
12
src/test/java/tests/apitests/gateway/models/addCareContext/Link.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,12 @@ | ||
package tests.apitests.gateway.models.addCareContext; | ||
|
||
import lombok.Builder; | ||
import lombok.Data; | ||
|
||
@Data | ||
@Builder | ||
public class Link { | ||
String accessToken; | ||
PatientCarecontext patient; | ||
|
||
} |
14 changes: 14 additions & 0 deletions
14
src/test/java/tests/apitests/gateway/models/addCareContext/PatientCarecontext.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,14 @@ | ||
package tests.apitests.gateway.models.addCareContext; | ||
|
||
import lombok.Builder; | ||
import lombok.Data; | ||
|
||
import java.util.List; | ||
|
||
@Data | ||
@Builder | ||
public class PatientCarecontext { | ||
String referenceNumber; | ||
String display; | ||
List<CareContextAdd> careContexts; | ||
} |
35 changes: 35 additions & 0 deletions
35
src/test/java/tests/apitests/gateway/tests/AddCareContext.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,35 @@ | ||
package tests.apitests.gateway.tests; | ||
|
||
import io.restassured.RestAssured; | ||
import io.restassured.path.json.JsonPath; | ||
import io.restassured.response.Response; | ||
import io.restassured.specification.RequestSpecification; | ||
import org.testng.Assert; | ||
import org.testng.annotations.BeforeClass; | ||
import org.testng.annotations.Test; | ||
import tests.apitests.helpers.utils.Login; | ||
|
||
import static tests.apitests.gateway.TestBuilders.addCareContextPayLoad; | ||
|
||
public class AddCareContext { | ||
String authToken; | ||
RequestSpecification request; | ||
JsonPath jsonPathEvaluator; | ||
|
||
@BeforeClass | ||
public void setup() { | ||
authToken = new Login().getGatewayAuthToken(); | ||
} | ||
|
||
@Test | ||
public void addCareContext() { | ||
request = RestAssured.given(); | ||
request.header("Authorization", authToken); | ||
request.header("X-CM-ID", "ndhm"); | ||
Response response = request.body(addCareContextPayLoad()).post("/v0.5/links/link/add-contexts"); | ||
jsonPathEvaluator = response.jsonPath(); | ||
response.prettyPrint(); | ||
Assert.assertEquals(response.getStatusCode(), 202); | ||
} | ||
|
||
} |