Skip to content

Commit

Permalink
hotfix, fix jenkins job issues and failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
MJCallahanPage committed Feb 27, 2017
1 parent c5dc74a commit 78d6d6f
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 7 deletions.
8 changes: 8 additions & 0 deletions project/MicroService.scala
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ trait MicroService {
evictionWarningOptions in update := EvictionWarningOptions.default.withWarnScalaVersionEviction(false),
routesGenerator := StaticRoutesGenerator
)
.configs(IntegrationTest)
.settings(inConfig(IntegrationTest)(Defaults.itSettings): _*)
.settings(
Keys.fork in IntegrationTest := false,
unmanagedSourceDirectories in IntegrationTest <<= (baseDirectory in IntegrationTest)(base => Seq(base / "it")),
addTestReportOption(IntegrationTest, "int-test-reports"),
testGrouping in IntegrationTest := oneForkedJvmPerTest((definedTests in IntegrationTest).value),
parallelExecution in IntegrationTest := false)
}

private object TestPhases {
Expand Down
22 changes: 21 additions & 1 deletion project/MicroServiceBuild.scala
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,27 @@ private object AppDependencies {
}.test
}

def apply() = compile ++ Test()
object IntegrationTest {
def apply() = new TestDependencies {

override lazy val scope: String = "it"

override lazy val test = Seq(
"uk.gov.hmrc" %% "hmrctest" % hmrcTestVersion % scope,
"org.scalatest" %% "scalatest" % scalaTestVersion % scope,
"org.pegdown" % "pegdown" % pegdownVersion % scope,
"com.typesafe.play" %% "play-test" % PlayVersion.current % scope,
"org.scalatestplus.play" %% "scalatestplus-play" % "1.5.1" % scope,
"org.scalaj" %% "scalaj-http" % scalaJVersion % scope,
"com.github.tomakehurst" % "wiremock" % wireMockVersion % scope,
"info.cukes" %% "cucumber-scala" % cucumberVersion % scope,
"info.cukes" % "cucumber-junit" % cucumberVersion % scope,
"org.mockito" % "mockito-core" % "1.9.5" % scope,
"com.github.fge" % "json-schema-validator" % "2.2.6" % scope
)
}.test
}

def apply() = compile ++ Test() ++ IntegrationTest()
}

4 changes: 3 additions & 1 deletion test/unit/connectors/mocks/MockSubscriptionConnector.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package unit.connectors.mocks

import audit.Logging
import config.AppConfig
import connectors.SubscriptionConnector
import models.subscription.business.BusinessSubscriptionRequestModel
Expand All @@ -32,14 +33,15 @@ trait MockSubscriptionConnector extends MockHttp with OneAppPerSuite {
lazy val config: Configuration = app.injector.instanceOf[Configuration]
lazy val appConfig: AppConfig = app.injector.instanceOf[AppConfig]
lazy val httpPost: HttpPost = mockHttpPost
lazy val logging: Logging = app.injector.instanceOf[Logging]

val mockPropertySubscribe = (setupMockPropertySubscribe(testNino) _).tupled
def mockBusinessSubscribe(payload: BusinessSubscriptionRequestModel) = (setupMockBusinessSubscribe(testNino, payload) _).tupled

val propertySubscribeSuccess = (OK, PropertySubscriptionResponse.successResponse(testSafeId, testMtditId, testSourceId))
val businessSubscribeSuccess = (OK, BusinessSubscriptionResponse.successResponse(testSafeId, testMtditId, testSourceId))

object TestSubscriptionConnector extends SubscriptionConnector(config, httpPost, appConfig)
object TestSubscriptionConnector extends SubscriptionConnector(config, httpPost, appConfig, logging)

def setupMockBusinessSubscribe(nino: String, payload: BusinessSubscriptionRequestModel)(status: Int, response: JsValue): Unit =
setupMockHttpPost(url = TestSubscriptionConnector.businessSubscribeUrl(nino), payload)(status, response)
Expand Down
10 changes: 5 additions & 5 deletions test/unit/services/RosmAndEnrolManagerServiceSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class RosmAndEnrolManagerServiceSpec extends MockSubscriptionManagerService {
mockRegister(registerRequestPayload)(regSuccess)
mockPropertySubscribe(propertySubscribeSuccess)
mockAddKnownFacts(knowFactsRequest)(addKnownFactsSuccess)
mockGovernmentGatewayEnrol(governmentGatewayEnrolPayload)(OK, enrolSuccess)
mockGovernmentGatewayEnrol(governmentGatewayEnrolPayload)((OK, enrolSuccess))
mockRefreshProfile(refreshSuccess)
call(fePropertyRequest).right.get.mtditId shouldBe testMtditId
}
Expand All @@ -51,7 +51,7 @@ class RosmAndEnrolManagerServiceSpec extends MockSubscriptionManagerService {
mockRegister(registerRequestPayload)(regSuccess)
mockBusinessSubscribe(businessSubscriptionRequestPayload)(businessSubscribeSuccess)
mockAddKnownFacts(knowFactsRequest)(addKnownFactsSuccess)
mockGovernmentGatewayEnrol(governmentGatewayEnrolPayload)(OK, enrolSuccess)
mockGovernmentGatewayEnrol(governmentGatewayEnrolPayload)((OK, enrolSuccess))
mockRefreshProfile(refreshSuccess)
call(feBusinessRequest).right.get.mtditId shouldBe testMtditId
}
Expand All @@ -61,7 +61,7 @@ class RosmAndEnrolManagerServiceSpec extends MockSubscriptionManagerService {
mockPropertySubscribe(propertySubscribeSuccess)
mockBusinessSubscribe(businessSubscriptionRequestPayload)(businessSubscribeSuccess)
mockAddKnownFacts(knowFactsRequest)(addKnownFactsSuccess)
mockGovernmentGatewayEnrol(governmentGatewayEnrolPayload)(OK, enrolSuccess)
mockGovernmentGatewayEnrol(governmentGatewayEnrolPayload)((OK, enrolSuccess))
mockRefreshProfile(refreshSuccess)
call(feBothRequest).right.get.mtditId shouldBe testMtditId
}
Expand All @@ -71,7 +71,7 @@ class RosmAndEnrolManagerServiceSpec extends MockSubscriptionManagerService {
mockPropertySubscribe(propertySubscribeSuccess)
mockBusinessSubscribe(businessSubscriptionRequestPayload)(businessSubscribeSuccess)
mockAddKnownFacts(knowFactsRequest)(addKnownFactsSuccess)
mockGovernmentGatewayEnrol(governmentGatewayEnrolPayload)(OK, enrolSuccess)
mockGovernmentGatewayEnrol(governmentGatewayEnrolPayload)((OK, enrolSuccess))
mockRefreshProfile(refreshFailure)
call(feBothRequest).left.get.status shouldBe INTERNAL_SERVER_ERROR
}
Expand All @@ -81,7 +81,7 @@ class RosmAndEnrolManagerServiceSpec extends MockSubscriptionManagerService {
mockPropertySubscribe(propertySubscribeSuccess)
mockBusinessSubscribe(businessSubscriptionRequestPayload)(businessSubscribeSuccess)
mockAddKnownFacts(knowFactsRequest)(addKnownFactsSuccess)
mockGovernmentGatewayEnrol(governmentGatewayEnrolPayload)(BAD_REQUEST, enrolFailure)
mockGovernmentGatewayEnrol(governmentGatewayEnrolPayload)((BAD_REQUEST, enrolFailure))
call(feBothRequest).left.get.status shouldBe BAD_REQUEST
}

Expand Down

0 comments on commit 78d6d6f

Please sign in to comment.