Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ADR-1303 Add test only clear return data #156

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/config/FrontendAppConfig.scala
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ class FrontendAppConfig @Inject() (configuration: Configuration, servicesConfig:
def adrCacheClearAllUrl(): String =
s"$adrReturnsHost/alcohol-duty-returns/test-only/cache/clear-all"

def adrCacheClearReturnDataUrl(appaId: String, periodKey: String): String =
s"$adrReturnsHost/alcohol-duty-returns/test-only/cache/clear-return/$appaId/$periodKey"

def adrGetObligationDetailsUrl(appaId: String): String =
s"$adrReturnsHost/alcohol-duty-returns/obligationDetails/$appaId"

Expand Down
5 changes: 5 additions & 0 deletions app/testonly/connectors/TestOnlyCacheConnector.scala
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,9 @@ class TestOnlyCacheConnector @Inject() (
httpClient.DELETE(
appConfig.adrCacheClearAllUrl()
)

def clearReturnData(appaId: String, periodKey: String)(implicit hc: HeaderCarrier): Future[HttpResponse] =
httpClient.DELETE(
appConfig.adrCacheClearReturnDataUrl(appaId, periodKey)
)
}
4 changes: 4 additions & 0 deletions app/testonly/controllers/TestOnlyController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,8 @@ class TestOnlyController @Inject() (
testOnlyConnector.clearAllData().map(httpResponse => Ok(httpResponse.body))
}

def clearReturnData(appaId: String, periodKey: String): Action[AnyContent] = Action.async { implicit request =>
testOnlyConnector.clearReturnData(appaId, periodKey).map(httpResponse => Ok(httpResponse.body))
}

}
3 changes: 2 additions & 1 deletion conf/test.routes
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
GET /clear-all testonly.controllers.TestOnlyController.clearAllData()
GET /clear-all testonly.controllers.TestOnlyController.clearAllData()
GET /clear-return/:appaId/:periodKey testonly.controllers.TestOnlyController.clearReturnData(appaId: String, periodKey: String)