From 97e6846d3adc5bf4a535c387eb0e9186cfdf3b2a Mon Sep 17 00:00:00 2001 From: "@diksha-diksha" <176032121+diksha-diksha@users.noreply.github.com> Date: Wed, 9 Oct 2024 12:34:16 +0100 Subject: [PATCH] DL-14575: VAT API-Removed scopes and refactored Unit and func test DL:14575- Removed unwanted scope case class --- app/definition/ApiDefinition.scala | 8 +------- app/definition/ApiDefinitionFactory.scala | 14 +------------- .../test/config/DocumentationControllerISpec.scala | 12 ------------ test/definition/ApiDefinitionFactorySpec.scala | 12 ------------ 4 files changed, 2 insertions(+), 44 deletions(-) diff --git a/app/definition/ApiDefinition.scala b/app/definition/ApiDefinition.scala index b3809190..0e0ad470 100644 --- a/app/definition/ApiDefinition.scala +++ b/app/definition/ApiDefinition.scala @@ -72,13 +72,7 @@ object APIDefinition { implicit val formatAPIDefinition: OFormat[APIDefinition] = Json.format[APIDefinition] } -case class Scope(key: String, name: String, description: String) - -object Scope { - implicit val formatScope: OFormat[Scope] = Json.format[Scope] -} - -case class Definition(scopes: Seq[Scope], api: APIDefinition) +case class Definition(api: APIDefinition) object Definition { implicit val formatDefinition: OFormat[Definition] = Json.format[Definition] diff --git a/app/definition/ApiDefinitionFactory.scala b/app/definition/ApiDefinitionFactory.scala index 5d8a9ad1..8fc10c57 100644 --- a/app/definition/ApiDefinitionFactory.scala +++ b/app/definition/ApiDefinitionFactory.scala @@ -30,19 +30,7 @@ class ApiDefinitionFactory @Inject()(appConfig: AppConfig) extends Logging{ lazy val definition: Definition = Definition( - scopes = Seq( - Scope( - key = readScope, - name = "View your VAT information", - description = "Allow read access to VAT data" - ), - Scope( - key = writeScope, - name = "Change your VAT information", - description = "Allow write access to VAT data" - ) - ), - api = APIDefinition( + api = APIDefinition( name = "VAT (MTD)", description = "An API for providing VAT data", diff --git a/func/test/config/DocumentationControllerISpec.scala b/func/test/config/DocumentationControllerISpec.scala index 87513db7..9b893d9c 100644 --- a/func/test/config/DocumentationControllerISpec.scala +++ b/func/test/config/DocumentationControllerISpec.scala @@ -43,18 +43,6 @@ class DocumentationControllerISpec extends IntegrationBaseSpec with FeatureToggl val apiDefinitionJson: JsValue = Json.parse( """ |{ - | "scopes":[ - | { - | "key":"read:vat", - | "name":"View your VAT information", - | "description":"Allow read access to VAT data" - | }, - | { - | "key":"write:vat", - | "name":"Change your VAT information", - | "description":"Allow write access to VAT data" - | } - | ], | "api":{ | "name":"VAT (MTD)", | "description":"An API for providing VAT data", diff --git a/test/definition/ApiDefinitionFactorySpec.scala b/test/definition/ApiDefinitionFactorySpec.scala index 8f1bf503..391c71b8 100644 --- a/test/definition/ApiDefinitionFactorySpec.scala +++ b/test/definition/ApiDefinitionFactorySpec.scala @@ -41,18 +41,6 @@ class ApiDefinitionFactorySpec extends UnitSpec { apiDefinitionFactory.definition shouldBe Definition( - scopes = Seq( - Scope( - key = readScope, - name = "View your VAT information", - description = "Allow read access to VAT data" - ), - Scope( - key = writeScope, - name = "Change your VAT information", - description = "Allow write access to VAT data" - ) - ), api = APIDefinition( name = "VAT (MTD)", description =