Search in sources :

Example 26 with StatusMessage

use of org.sagebionetworks.bridge.models.StatusMessage in project BridgeServer2 by Sage-Bionetworks.

the class HealthDataDocumentationControllerTest method deleteHealthDataDocumentationForIdentifier.

@Test
public void deleteHealthDataDocumentationForIdentifier() {
    StatusMessage statusMessage = controller.deleteHealthDataDocumentationForIdentifier(IDENTIFIER);
    assertEquals(statusMessage.getMessage(), "Health data documentation has been deleted for the given identifier.");
    verify(mockService).deleteHealthDataDocumentation(TEST_APP_ID, IDENTIFIER);
}
Also used : StatusMessage(org.sagebionetworks.bridge.models.StatusMessage) Test(org.testng.annotations.Test)

Example 27 with StatusMessage

use of org.sagebionetworks.bridge.models.StatusMessage in project BridgeServer2 by Sage-Bionetworks.

the class SurveyControllerTest method adminCanLogicallyDelete.

@Test
public void adminCanLogicallyDelete() throws Exception {
    setupContext(TEST_APP_ID, UNCONSENTED, ADMIN);
    doReturn(session).when(controller).getAuthenticatedSession(DEVELOPER);
    Survey survey = getSurvey(false);
    when(mockSurveyService.getSurvey(TEST_APP_ID, KEYS, false, false)).thenReturn(survey);
    StatusMessage result = controller.deleteSurvey(SURVEY_GUID, CREATED_ON.toString(), false);
    assertEquals(result, SurveyController.DELETED_MSG);
    verify(mockSurveyService).getSurvey(TEST_APP_ID, KEYS, false, false);
    verify(mockSurveyService).deleteSurvey(TEST_APP_ID, survey);
    verifyNoMoreInteractions(mockSurveyService);
}
Also used : TestSurvey(org.sagebionetworks.bridge.TestSurvey) Survey(org.sagebionetworks.bridge.models.surveys.Survey) DynamoSurvey(org.sagebionetworks.bridge.dynamodb.DynamoSurvey) StatusMessage(org.sagebionetworks.bridge.models.StatusMessage) Test(org.testng.annotations.Test)

Example 28 with StatusMessage

use of org.sagebionetworks.bridge.models.StatusMessage in project BridgeServer2 by Sage-Bionetworks.

the class SurveyControllerTest method physicalDeleteAllowedForAdmin.

@Test
public void physicalDeleteAllowedForAdmin() throws Exception {
    setupContext(TEST_APP_ID, UNCONSENTED, ADMIN);
    doReturn(session).when(controller).getAuthenticatedSession(DEVELOPER);
    Survey survey = getSurvey(false);
    when(mockSurveyService.getSurvey(TEST_APP_ID, KEYS, false, false)).thenReturn(survey);
    StatusMessage result = controller.deleteSurvey(SURVEY_GUID, CREATED_ON.toString(), true);
    assertEquals(result, SurveyController.DELETED_MSG);
    verify(mockSurveyService).getSurvey(TEST_APP_ID, KEYS, false, false);
    verify(mockSurveyService).deleteSurveyPermanently(TEST_APP_ID, survey);
    verifyNoMoreInteractions(mockSurveyService);
}
Also used : TestSurvey(org.sagebionetworks.bridge.TestSurvey) Survey(org.sagebionetworks.bridge.models.surveys.Survey) DynamoSurvey(org.sagebionetworks.bridge.dynamodb.DynamoSurvey) StatusMessage(org.sagebionetworks.bridge.models.StatusMessage) Test(org.testng.annotations.Test)

Example 29 with StatusMessage

use of org.sagebionetworks.bridge.models.StatusMessage in project BridgeServer2 by Sage-Bionetworks.

the class SurveyControllerTest method deleteSurveyAllowedForDeveloper.

@Test
public void deleteSurveyAllowedForDeveloper() throws Exception {
    setupContext(TEST_APP_ID, UNCONSENTED, DEVELOPER);
    doReturn(session).when(controller).getAuthenticatedSession(DEVELOPER);
    Survey survey = getSurvey(false);
    when(mockSurveyService.getSurvey(TEST_APP_ID, KEYS, false, false)).thenReturn(survey);
    StatusMessage result = controller.deleteSurvey(SURVEY_GUID, CREATED_ON.toString(), false);
    assertEquals(result, SurveyController.DELETED_MSG);
    verify(mockSurveyService).getSurvey(TEST_APP_ID, KEYS, false, false);
    verify(mockSurveyService).deleteSurvey(TEST_APP_ID, survey);
    verifyNoMoreInteractions(mockSurveyService);
}
Also used : TestSurvey(org.sagebionetworks.bridge.TestSurvey) Survey(org.sagebionetworks.bridge.models.surveys.Survey) DynamoSurvey(org.sagebionetworks.bridge.dynamodb.DynamoSurvey) StatusMessage(org.sagebionetworks.bridge.models.StatusMessage) Test(org.testng.annotations.Test)

Example 30 with StatusMessage

use of org.sagebionetworks.bridge.models.StatusMessage in project BridgeServer2 by Sage-Bionetworks.

the class TemplateControllerTest method deleteTemplate.

@Test
public void deleteTemplate() throws Exception {
    StatusMessage message = controller.deleteTemplate(GUID, "false");
    assertEquals(message.getMessage(), "Template deleted.");
    verify(mockTemplateService).deleteTemplate(TEST_APP_ID, GUID);
}
Also used : StatusMessage(org.sagebionetworks.bridge.models.StatusMessage) Test(org.testng.annotations.Test)

Aggregations

StatusMessage (org.sagebionetworks.bridge.models.StatusMessage)239 Test (org.testng.annotations.Test)168 UserSession (org.sagebionetworks.bridge.models.accounts.UserSession)58 PostMapping (org.springframework.web.bind.annotation.PostMapping)43 StudyParticipant (org.sagebionetworks.bridge.models.accounts.StudyParticipant)36 App (org.sagebionetworks.bridge.models.apps.App)28 ResponseStatus (org.springframework.web.bind.annotation.ResponseStatus)23 DeleteMapping (org.springframework.web.bind.annotation.DeleteMapping)22 Account (org.sagebionetworks.bridge.models.accounts.Account)21 ReportData (org.sagebionetworks.bridge.models.reports.ReportData)13 SignIn (org.sagebionetworks.bridge.models.accounts.SignIn)12 AccountId (org.sagebionetworks.bridge.models.accounts.AccountId)11 RequestContext (org.sagebionetworks.bridge.RequestContext)10 EntityNotFoundException (org.sagebionetworks.bridge.exceptions.EntityNotFoundException)10 DateRangeResourceList (org.sagebionetworks.bridge.models.DateRangeResourceList)10 JsonNode (com.fasterxml.jackson.databind.JsonNode)9 HealthDataSubmission (org.sagebionetworks.bridge.models.healthdata.HealthDataSubmission)9 Cookie (javax.servlet.http.Cookie)6 Appointment (org.hl7.fhir.dstu3.model.Appointment)6 NotificationMessage (org.sagebionetworks.bridge.models.notifications.NotificationMessage)6