This repository has been archived by the owner on Jun 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
API-4360 enable Q and QR update ITs (#65)
- Loading branch information
1 parent
5eeb98b
commit 655c04d
Showing
3 changed files
with
50 additions
and
7 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
44 changes: 44 additions & 0 deletions
44
...sts/src/test/java/gov/va/api/health/patientgenerateddata/tests/QuestionnaireUpdateIT.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,44 @@ | ||
package gov.va.api.health.patientgenerateddata.tests; | ||
|
||
import static gov.va.api.health.patientgenerateddata.tests.RequestUtils.doGet; | ||
import static gov.va.api.health.patientgenerateddata.tests.RequestUtils.doPut; | ||
import static gov.va.api.health.patientgenerateddata.tests.SystemDefinitions.systemDefinition; | ||
import static gov.va.api.health.sentinel.EnvironmentAssumptions.assumeEnvironmentIn; | ||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import gov.va.api.health.r4.api.resources.Questionnaire; | ||
import gov.va.api.health.r4.api.resources.Questionnaire.PublicationStatus; | ||
import gov.va.api.health.sentinel.Environment; | ||
import gov.va.api.health.sentinel.ExpectedResponse; | ||
import java.time.Instant; | ||
import org.junit.Test; | ||
import org.junit.jupiter.api.BeforeAll; | ||
|
||
public class QuestionnaireUpdateIT { | ||
|
||
static Questionnaire _questionnaire(String id) { | ||
return Questionnaire.builder().id(id).status(PublicationStatus.active).build(); | ||
} | ||
|
||
@BeforeAll | ||
static void setup() { | ||
// These tests alter data, but do not infinitely create more | ||
// Do not run in SLA'd environments | ||
assumeEnvironmentIn( | ||
Environment.LOCAL, Environment.QA, Environment.STAGING, Environment.STAGING_LAB); | ||
|
||
var id = systemDefinition().ids().questionnaireUpdates(); | ||
doGet("application/json", "Questionnaire/" + id, 200); | ||
} | ||
|
||
@Test | ||
public void update_description() { | ||
Instant now = Instant.now(); | ||
var id = systemDefinition().ids().questionnaireUpdates(); | ||
Questionnaire questionnaire = _questionnaire(id).description(now.toString()); | ||
doPut("Questionnaire/" + id, questionnaire, "update description", 200); | ||
ExpectedResponse persistedResponse = doGet("application/json", "Questionnaire/" + id, 200); | ||
Questionnaire persisted = persistedResponse.response().as(Questionnaire.class); | ||
assertThat(persisted.description()).isEqualTo(now.toString()); | ||
} | ||
} |