Skip to content

Commit

Permalink
Temp commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Ioann Kurchin committed Feb 16, 2022
1 parent 4b205d9 commit ea04c1c
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,19 @@ class ProjectConfigurationControllerTest extends AsyncWordSpec with Matchers wit

"return success for update configuration" in {
when(configurationService.addConfiguration(configuration, accessToken.userId)).thenReturn(Future.unit)
Put(s"/projects/${projectId}/configurations", configurationAdditionRequest) ~> configurationController
.route(
accessToken
) ~> check {
Put(s"/projects/${projectId}/configurations", configurationAdditionRequest) ~> configurationController.route(
accessToken
) ~> check {
status shouldBe StatusCodes.NoContent
}
}

"return InternalServerError when failure update configuration" in {
val error = InternalError("Something went wrong")
when(configurationService.addConfiguration(configuration, accessToken.userId)).thenReturn(Future.failed(error))
Put(s"/projects/${projectId}/configurations", configurationAdditionRequest) ~> configurationController
.route(
accessToken
) ~> check {
Put(s"/projects/${projectId}/configurations", configurationAdditionRequest) ~> configurationController.route(
accessToken
) ~> check {
status shouldBe StatusCodes.InternalServerError
entityAs[String] shouldBe "Something went wrong"
}
Expand All @@ -70,10 +68,9 @@ class ProjectConfigurationControllerTest extends AsyncWordSpec with Matchers wit
"return NotFound when failure find project to update configuration" in {
when(configurationService.addConfiguration(configuration, accessToken.userId))
.thenReturn(Future.failed(NotFound()))
Put(s"/projects/${projectId}/configurations", configurationAdditionRequest) ~> configurationController
.route(
accessToken
) ~> check {
Put(s"/projects/${projectId}/configurations", configurationAdditionRequest) ~> configurationController.route(
accessToken
) ~> check {
status shouldBe StatusCodes.NotFound
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package cromwell.pipeline.datastorage.dao.repository

import cromwell.pipeline.datastorage.dao.mongo.DocumentCodecInstances.projectConfigurationDocumentCodec
import cromwell.pipeline.datastorage.dao.mongo.DocumentRepository
import cromwell.pipeline.datastorage.dto.{ ProjectConfiguration, ProjectConfigurationId, ProjectId }
import cromwell.pipeline.model.wrapper.ProjectId
import cromwell.pipeline.datastorage.dto.ProjectConfiguration
import cromwell.pipeline.model.wrapper.{ ProjectConfigurationId, ProjectId }

import scala.concurrent.{ ExecutionContext, Future }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package cromwell.pipeline.datastorage.dao.repository

import cromwell.pipeline.database.PipelineDatabaseEngine
import cromwell.pipeline.datastorage.dao.entry.RunEntry
import cromwell.pipeline.datastorage.dto.{ ProjectId, Run }
import cromwell.pipeline.datastorage.dto.Run
import cromwell.pipeline.model.wrapper.{ ProjectId, RunId, UserId }

import scala.concurrent.Future
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ final case class Project(
version: PipelineVersion,
visibility: Visibility = Private
)

object Project {
implicit lazy val projectFormat: OFormat[Project] = Json.format[Project]
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package cromwell.pipeline.datastorage.dao.repository

import java.nio.file.Paths

import cromwell.pipeline.datastorage.dao.mongo.DocumentCodecInstances.projectConfigurationDocumentCodec
import cromwell.pipeline.datastorage.dao.mongo.DocumentRepository
import cromwell.pipeline.datastorage.dao.utils.TestProjectUtils
import cromwell.pipeline.datastorage.dto._
import cromwell.pipeline.model.wrapper.{ ProjectConfigurationId, ProjectId }
import org.mockito.Mockito.when
import org.scalatest.{ AsyncWordSpec, Matchers }
import org.scalatestplus.mockito.MockitoSugar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ package cromwell.pipeline.service
import cromwell.pipeline.datastorage.dao.repository.ProjectConfigurationRepository
import cromwell.pipeline.datastorage.dto._
import cromwell.pipeline.model.wrapper.{ ProjectConfigurationId, ProjectId, UserId }
import cromwell.pipeline.service.ProjectConfigurationService.Exceptions.{ AccessDenied, InternalError, NotFound, ValidationError }
import cromwell.pipeline.service.ProjectConfigurationService.Exceptions.{
AccessDenied,
InternalError,
NotFound,
ValidationError
}
import cromwell.pipeline.service.ProjectService.Exceptions.ProjectServiceException
import cromwell.pipeline.service.exceptions.ServiceException
import cromwell.pipeline.womtool.WomToolAPI
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ import cromwell.pipeline.datastorage.dao.utils.{ TestProjectUtils, TestRunUtils,
import cromwell.pipeline.datastorage.dto._
import cromwell.pipeline.model.wrapper.ProjectConfigurationId
import cromwell.pipeline.service.ProjectService.Exceptions.NotFound
import cromwell.pipeline.service.impls.{ ProjectConfigurationServiceTestImpl, ProjectServiceTestImpl, ProjectVersioningTestImpl }
import cromwell.pipeline.service.impls.{
ProjectConfigurationServiceTestImpl,
ProjectServiceTestImpl,
ProjectVersioningTestImpl
}
import org.scalatest.{ AsyncWordSpec, Matchers }

import java.nio.file.Paths
Expand Down

0 comments on commit ea04c1c

Please sign in to comment.