Skip to content

Commit

Permalink
update newly merged tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ahaessly committed Dec 8, 2017
1 parent 4af1116 commit d4d133a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ final class TrialService
val trialProject = trialDAO.claimProjectRecord(WorkbenchUserInfo(userInfo.userSubjectId, userInfo.userEmail))
UserTrialStatus(userId = userInfo.userSubjectId, state = Some(Enabled), enabledDate = Instant.now, billingProjectName = Some(trialProject.name.value))
} else {
currentStatus.get
currentStatus.get.copy(state = Some(Enabled))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import org.broadinstitute.dsde.firecloud.mock.MockUtils
import org.broadinstitute.dsde.firecloud.mock.MockUtils.thurloeServerPort
import org.broadinstitute.dsde.firecloud.model.ModelJsonProtocol.impProfileWrapper
import org.broadinstitute.dsde.firecloud.model.Trial.TrialStates.{Disabled, Enrolled}
import org.broadinstitute.dsde.firecloud.model.Trial.{TrialStates, UserTrialStatus}
import org.broadinstitute.dsde.firecloud.model.Trial.{CreationStatuses, TrialProject, TrialStates, UserTrialStatus}
import org.broadinstitute.dsde.firecloud.model.{FireCloudKeyValue, ProfileWrapper, RegistrationInfo, UserInfo, WithAccessToken, WorkbenchEnabled, WorkbenchUserInfo}
import org.broadinstitute.dsde.firecloud.service.{BaseServiceSpec, TrialService}
import org.broadinstitute.dsde.firecloud.trial.ProjectManager
Expand Down Expand Up @@ -181,15 +181,15 @@ final class TrialApiServiceSpec extends BaseServiceSpec with UserApiService with
}

"Attempting to enable a previously disabled user should return success" in {
Post(enablePath, Seq(disabledUser, enabledUser)) ~> dummyUserIdHeaders(disabledUser) ~> trialApiServiceRoutes ~> check {
Post(enablePath, Seq(disabledUser, enabledUser)) ~> dummyUserIdHeaders(manager) ~> trialApiServiceRoutes ~> check {
val enableResponse = responseAs[Map[String, Seq[String]]]
assertResult(Map("Success"->Seq(disabledUser), "NoChangeRequired"->Seq(enabledUser))) { enableResponse }
assertResult(OK) {status}
}
}

"Attempting to enable a previously enabled user should return NoChangeRequired success" in {
Post(enablePath, Seq(enabledUser)) ~> dummyUserIdHeaders(enabledUser) ~> trialApiServiceRoutes ~> check {
Post(enablePath, Seq(enabledUser)) ~> dummyUserIdHeaders(manager) ~> trialApiServiceRoutes ~> check {
val enableResponse = responseAs[Map[String, Seq[String]]]
assertResult(Map("NoChangeRequired"->Seq(enabledUser))) { enableResponse }
assertResult(OK) {status}
Expand All @@ -211,7 +211,7 @@ final class TrialApiServiceSpec extends BaseServiceSpec with UserApiService with
successfulOperationPaths.foreach { successfulOperationPath =>
s"Attempting $successfulOperationPath on ${targetUsers.head} as $manager should return NoContent success" in {
Post(successfulOperationPath, targetUsers) ~> dummyUserIdHeaders(manager) ~> trialApiServiceRoutes ~> check {
assertResult(NoContent, response.entity.asString) { status }
assertResult(OK, response.entity.asString) { status }
}
}

Expand Down Expand Up @@ -333,7 +333,7 @@ final class TrialApiServiceSpec extends BaseServiceSpec with UserApiService with
Future.successful(Success(()))
}
case user @ `dummy2User` => { // Mocking Thurloe status saving failures
Future.successful(Failure(new InternalError(s"Cannot save trial status for $user")))
Future.failed(new InternalError(s"Cannot save trial status for $user"))
}
case _ => {
fail("Should only be updating enabled, disabled or enrolled users")
Expand Down

0 comments on commit d4d133a

Please sign in to comment.