From d0235e6d17f406070f58bdfd99aaf09b638c49f6 Mon Sep 17 00:00:00 2001 From: John Green Date: Wed, 11 Dec 2024 17:50:30 +0000 Subject: [PATCH] API-8051: Subscriptions are not being deleted by TPA --- app/uk/gov/hmrc/apipublisher/connectors/TpaConnector.scala | 3 ++- it/test/uk/gov/hmrc/apipublisher/PublisherFeatureSpec.scala | 6 +++--- .../gov/hmrc/apipublisher/connectors/TpaConnectorSpec.scala | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/uk/gov/hmrc/apipublisher/connectors/TpaConnector.scala b/app/uk/gov/hmrc/apipublisher/connectors/TpaConnector.scala index 0d478a5..df440b8 100644 --- a/app/uk/gov/hmrc/apipublisher/connectors/TpaConnector.scala +++ b/app/uk/gov/hmrc/apipublisher/connectors/TpaConnector.scala @@ -37,7 +37,8 @@ class TpaConnector @Inject() (config: TpaConnector.Config, http: HttpClientV2)(i protected val serviceBaseUrl: String = config.serviceBaseUrl def deleteSubscriptions(apiContext: String, versionNbr: String)(implicit hc: HeaderCarrier): Future[Unit] = { - http.delete(url"$serviceBaseUrl/apis/$apiContext/versions/$versionNbr/subscribers") + val url = s"$serviceBaseUrl/apis/$apiContext/versions/$versionNbr/subscribers" + http.delete(url"$url") .execute[Either[UpstreamErrorResponse, HttpResponse]] .map { case Right(_) => (()) diff --git a/it/test/uk/gov/hmrc/apipublisher/PublisherFeatureSpec.scala b/it/test/uk/gov/hmrc/apipublisher/PublisherFeatureSpec.scala index a805a7e..c2e0198 100644 --- a/it/test/uk/gov/hmrc/apipublisher/PublisherFeatureSpec.scala +++ b/it/test/uk/gov/hmrc/apipublisher/PublisherFeatureSpec.scala @@ -434,9 +434,9 @@ class PublisherFeatureSpec extends BaseFeatureSpec with EitherValues { val apiSubscriptionFieldsUrlVersion_1_0 = s"/definition/context/$urlEncodedApiContext/version/1.0" val apiSubscriptionFieldsUrlVersion_2_0 = s"/definition/context/$urlEncodedApiContext/version/2.0" val apiSubscriptionFieldsUrlVersion_3_0 = s"/definition/context/$urlEncodedApiContext/version/3.0" - val tpaVersion_1_0 = s"/apis/$urlEncodedApiContext/versions/1.0/subscribers" - val tpaVersion_2_0 = s"/apis/$urlEncodedApiContext/versions/2.0/subscribers" - val tpaVersion_3_0 = s"/apis/$urlEncodedApiContext/versions/3.0/subscribers" + val tpaVersion_1_0 = s"/apis/$apiContext/versions/1.0/subscribers" + val tpaVersion_2_0 = s"/apis/$apiContext/versions/2.0/subscribers" + val tpaVersion_3_0 = s"/apis/$apiContext/versions/3.0/subscribers" val definitionJsonWithInvalidContext = s""" diff --git a/test/uk/gov/hmrc/apipublisher/connectors/TpaConnectorSpec.scala b/test/uk/gov/hmrc/apipublisher/connectors/TpaConnectorSpec.scala index 84877e9..a7d7b87 100644 --- a/test/uk/gov/hmrc/apipublisher/connectors/TpaConnectorSpec.scala +++ b/test/uk/gov/hmrc/apipublisher/connectors/TpaConnectorSpec.scala @@ -50,7 +50,7 @@ class TpaConnectorSpec extends AsyncHmrcSpec with BeforeAndAfterAll with GuiceOn val connector = new TpaConnector(tpaConfig, app.injector.instanceOf[HttpClientV2]) - val apiContext = "hello" + val apiContext = "test/hello" val apiVersion = "1.0" val url = s"/apis/$apiContext/versions/$apiVersion/subscribers" val errorResponseBody = """{"code":"INTERNAL_ERROR","message":"Something is wrong"}"""