Skip to content
This repository has been archived by the owner on Jun 23, 2023. It is now read-only.

Commit

Permalink
API-4360 enable Q and QR update ITs (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
apeirats-va authored Jan 20, 2021
1 parent 5eeb98b commit 655c04d
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ private static Ids ids() {
.systemAndCode("venue$https://staff.apps.va.gov/VistaEmrService/clinics|534/12975")
.systemWithAnyCode("venue$https://staff.apps.va.gov/VistaEmrService/clinics|")
.build())
.questionnaireUpdates("00000000-0000-0000-0000-000000000000")
.questionnaireResponse("f003043a-9047-4c3a-b15b-a26c67f4e723")
.questionnaireResponseAuthor("1011537977V693883")
.questionnaireResponseSubject("1011537977V693883")
.questionnaireResponseUpdates("4400ade6-4162-44e2-b470-c6b38c717f88")
.questionnaireResponseUpdates("00000000-0000-0000-0000-000000000000")
.questionnaireResponseMetaTag(
Ids.MetaTag.builder()
.system("https://veteran.apps.va.gov/appointments/v1")
Expand Down Expand Up @@ -151,6 +152,8 @@ static final class Ids {

@NonNull UsageContextTypeValue questionnaireContextTypeValue;

@NonNull String questionnaireUpdates;

@NonNull String questionnaireResponse;

@NonNull String questionnaireResponseAuthor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,8 @@ static QuestionnaireResponse questionnaireResponse(String id) {
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);

// Until a more permanent, update-specific QR Resource is made available, these tests should
// only run locally
assumeEnvironmentIn(Environment.LOCAL);
assumeEnvironmentIn(
Environment.LOCAL, Environment.QA, Environment.STAGING, Environment.STAGING_LAB);

var id = systemDefinition().ids().questionnaireResponseUpdates();
doGet("application/json", "QuestionnaireResponse/" + id, 200);
Expand Down
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());
}
}

0 comments on commit 655c04d

Please sign in to comment.