-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MTDSA-9603: Marriage Allowance feature switching (#68)
* MTDSA-9603: Add feature switching for marriage allowance. * Delete sbt.json
- Loading branch information
1 parent
ddfa366
commit a0e9af2
Showing
9 changed files
with
116 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,4 +22,5 @@ npm-debug.log | |
yarn-debug.log | ||
yarn-error.log | ||
./bsp | ||
./bsp/sbt.json | ||
./bsp/sbt.json | ||
/.bsp/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
POST /marriage-allowance/:nino v1.controllers.CreateMarriageAllowanceController.createMarriageAllowance(nino: String) | ||
|
||
PUT /:nino/:taxYear v1.controllers.AmendDisclosuresController.amendDisclosures(nino: String, taxYear: String) | ||
|
||
DELETE /:nino/:taxYear v1.controllers.DeleteDisclosuresController.deleteDisclosures(nino: String, taxYear: String) | ||
GET /:nino/:taxYear v1.controllers.RetrieveDisclosuresController.retrieveDisclosures(nino: String, taxYear: String) | ||
DELETE /:nino/:taxYear v1.controllers.DeleteDisclosuresController.deleteDisclosures(nino: String, taxYear: String) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
POST /marriage-allowance/:nino v1.controllers.CreateMarriageAllowanceController.createMarriageAllowance(nino: String) | ||
|
||
PUT /:nino/:taxYear v1.controllers.AmendDisclosuresController.amendDisclosures(nino: String, taxYear: String) | ||
GET /:nino/:taxYear v1.controllers.RetrieveDisclosuresController.retrieveDisclosures(nino: String, taxYear: String) | ||
DELETE /:nino/:taxYear v1.controllers.DeleteDisclosuresController.deleteDisclosures(nino: String, taxYear: String) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/* | ||
* Copyright 2021 HM Revenue & Customs | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package routing | ||
|
||
import com.github.tomakehurst.wiremock.stubbing.StubMapping | ||
import play.api.http.HeaderNames.ACCEPT | ||
import play.api.http.Status._ | ||
import play.api.libs.json.{JsValue, Json} | ||
import play.api.libs.ws.{WSRequest, WSResponse} | ||
import support.IntegrationBaseSpec | ||
import v1.models.errors.NotFoundError | ||
import v1.stubs.{AuditStub, AuthStub, MtdIdLookupStub} | ||
|
||
class LiveRoutesISpec extends IntegrationBaseSpec { | ||
|
||
override def servicesConfig: Map[String, Any] = Map( | ||
"microservice.services.des.host" -> mockHost, | ||
"microservice.services.des.port" -> mockPort, | ||
"microservice.services.ifs.host" -> mockHost, | ||
"microservice.services.ifs.port" -> mockPort, | ||
"microservice.services.mtd-id-lookup.host" -> mockHost, | ||
"microservice.services.mtd-id-lookup.port" -> mockPort, | ||
"microservice.services.auth.host" -> mockHost, | ||
"microservice.services.auth.port" -> mockPort, | ||
"auditing.consumer.baseUri.port" -> mockPort, | ||
"minimumPermittedTaxYear" -> 2020, | ||
"feature-switch.marriage-allowance.enabled" -> false, | ||
) | ||
|
||
private trait Test { | ||
val nino: String = "AA111111A" | ||
|
||
val requestBodyJson: JsValue = Json.parse( | ||
s""" | ||
|{ | ||
| "spouseOrCivilPartnerNino": "AA123456A", | ||
| "spouseOrCivilPartnerFirstName": "John", | ||
| "spouseOrCivilPartnerSurname": "Smith", | ||
| "spouseOrCivilPartnerDateOfBirth": "1986-04-06" | ||
|} | ||
""".stripMargin | ||
) | ||
|
||
def uri: String = s"/marriage-allowance/$nino" | ||
|
||
def setupStubs(): StubMapping | ||
|
||
def request(uri: String): WSRequest = { | ||
setupStubs() | ||
buildRequest(uri) | ||
.withHttpHeaders((ACCEPT, "application/vnd.hmrc.1.0+json")) | ||
} | ||
} | ||
|
||
"Calling the 'create marriage allowance' endpoint (switched on in production)" should { | ||
"return a 404 status code" when { | ||
"the feature switch is turned off to point to live routes only" in new Test { | ||
|
||
override def setupStubs(): StubMapping = { | ||
AuditStub.audit() | ||
AuthStub.authorised() | ||
MtdIdLookupStub.ninoFound(nino) | ||
} | ||
|
||
val response: WSResponse = await(request(uri).post(requestBodyJson)) | ||
response.body shouldBe Json.toJson(NotFoundError).toString() | ||
response.status shouldBe NOT_FOUND | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters