use of org.sagebionetworks.bridge.models.StatusMessage in project BridgeServer2 by Sage-Bionetworks.
the class ParticipantDataControllerTest method testDeleteAllParticipantDataForAdmin.
@Test
public void testDeleteAllParticipantDataForAdmin() {
doReturn(session).when(controller).getAuthenticatedSession(ADMIN);
StatusMessage result = controller.deleteAllParticipantDataForAdmin(session.getAppId(), session.getId());
assertEquals(result.getMessage(), "Participant data deleted.");
verify(mockParticipantDataService).deleteAllParticipantData(TEST_USER_ID);
}
use of org.sagebionetworks.bridge.models.StatusMessage in project BridgeServer2 by Sage-Bionetworks.
the class IntentControllerTest method canSubmitAnIntent.
@Test
public void canSubmitAnIntent() throws Exception {
// See comment in controller. Client APIs send scope as part of signature for legacy
// reasons, but it is not part of the consent signature. Controller transfers it to the ITP.
IntentToParticipate intent = createIntentToParticipate();
JsonNode node = BridgeObjectMapper.get().valueToTree(intent);
((ObjectNode) node).remove("scope");
((ObjectNode) node.get("consentSignature")).put("scope", "all_qualified_researchers");
mockRequestBody(mockRequest, node.toString());
StatusMessage result = controller.submitIntentToParticipate();
assertEquals(result, IntentController.SUBMITTED_MSG);
verify(mockIntentService).submitIntentToParticipate(intentCaptor.capture());
IntentToParticipate captured = intentCaptor.getValue();
// It's pretty simple, we just want to make sure we got it, check a couple of fields
assertEquals(captured.getPhone().getNumber(), PHONE.getNumber());
assertEquals(captured.getConsentSignature().getName(), "Gladlight Stonewell");
assertEquals(captured.getScope(), ALL_QUALIFIED_RESEARCHERS);
}
use of org.sagebionetworks.bridge.models.StatusMessage in project BridgeServer2 by Sage-Bionetworks.
the class MasterSchedulerControllerTest method deleteSchedulerConfig.
@Test
public void deleteSchedulerConfig() throws Exception {
StatusMessage message = controller.deleteSchedulerConfig(SCHEDULE_ID);
assertEquals(message.getMessage(), "Scheduler config deleted.");
verify(mockSchedulerService).deleteSchedulerConfig(SCHEDULE_ID);
}
use of org.sagebionetworks.bridge.models.StatusMessage in project BridgeServer2 by Sage-Bionetworks.
the class ParticipantControllerTest method sendInstallLink.
@Test
public void sendInstallLink() {
session.setParticipant(new StudyParticipant.Builder().withRoles(ImmutableSet.of(RESEARCHER)).build());
Account account = Account.create();
account.setId(TEST_USER_ID);
account.setHealthCode(HEALTH_CODE);
account.setEmail(EMAIL);
account.setEmailVerified(true);
account.setPhone(PHONE);
account.setPhoneVerified(true);
when(mockAccountService.getAccount(any())).thenReturn(Optional.of(account));
StatusMessage retValue = controller.sendInstallLink(TEST_USER_ID, "Android");
assertSame(retValue, INSTALL_LINK_SEND_MSG);
verify(mockParticipantService).sendInstallLinkMessage(app, PROMOTIONAL, HEALTH_CODE, EMAIL, PHONE, "Android");
}
use of org.sagebionetworks.bridge.models.StatusMessage in project BridgeServer2 by Sage-Bionetworks.
the class ParticipantControllerTest method resendEmailVerification.
@Test
public void resendEmailVerification() throws Exception {
StatusMessage result = controller.resendEmailVerification(TEST_USER_ID);
assertEquals(result.getMessage(), "Email verification request has been resent to user.");
verify(mockParticipantService).resendVerification(app, ChannelType.EMAIL, TEST_USER_ID);
}
Aggregations