@@ -25,6 +25,7 @@ import org.apache.pekko.stream.Materializer
2525import play .api .http .Status .{INTERNAL_SERVER_ERROR , NOT_FOUND , OK , SEE_OTHER }
2626import play .api .mvc .MessagesControllerComponents
2727import play .api .test .Helpers ._
28+ import uk .gov .hmrc .apiplatform .modules .apis .domain .models .ApiCategory .VAT_MTD
2829import uk .gov .hmrc .apiplatform .modules .apis .domain .models ._
2930import uk .gov .hmrc .apiplatform .modules .common .domain .models ._
3031import uk .gov .hmrc .http .NotFoundException
@@ -472,7 +473,7 @@ class ApiDocumentationControllerSpec extends CommonControllerBaseSpec with PageR
472473 verifyNotFoundPageRendered(result)
473474 }
474475
475- " display the OAS when no RAML is found including fraud prevention information" in new Setup {
476+ " display the OAS when no RAML is found including fraud prevention information using info from Cat Map " in new Setup {
476477 theUserIsLoggedIn()
477478
478479 theDefinitionServiceWillReturnAnApiDefinition(
@@ -489,6 +490,23 @@ class ApiDocumentationControllerSpec extends CommonControllerBaseSpec with PageR
489490 contentAsString(result) should include(" Fraud Prevention" )
490491 }
491492
493+ " display the OAS when no RAML is found including fraud prevention information using info from Api" in new Setup {
494+ theUserIsLoggedIn()
495+
496+ theDefinitionServiceWillReturnAnApiDefinition(
497+ extendedApiDefinition(serviceName = serviceName.value).copy(categories = List (VAT_MTD ))
498+ )
499+
500+ theDocumentationServiceWillFetchNoSpecification()
501+ when(downloadConnector.fetch(* [ServiceName ], * [ApiVersionNbr ], * )).thenReturn(successful(None ))
502+
503+ val result = underTest.renderApiDocumentation(serviceName, versionOne, Option (true ), None )(request)
504+
505+ status(result) shouldBe OK
506+ contentAsString(result) should include(" Endpoints" )
507+ contentAsString(result) should include(" Fraud Prevention" )
508+ }
509+
492510 " render OAS for a test support API without including fraud prevention information" in new Setup {
493511 theUserIsLoggedIn()
494512
@@ -506,6 +524,24 @@ class ApiDocumentationControllerSpec extends CommonControllerBaseSpec with PageR
506524 contentAsString(result) should include(" Endpoints" )
507525 contentAsString(result) should not include (" Fraud Prevention" )
508526 }
527+
528+ " display the OAS when no RAML is found not including fraud prevention information" in new Setup {
529+ theUserIsLoggedIn()
530+
531+ theDefinitionServiceWillReturnAnApiDefinition(
532+ extendedApiDefinition(serviceName = serviceName.value)
533+ )
534+
535+ theDocumentationServiceWillFetchNoSpecification()
536+ when(downloadConnector.fetch(* [ServiceName ], * [ApiVersionNbr ], * )).thenReturn(successful(None ))
537+
538+ val result = underTest.renderApiDocumentation(serviceName, versionOne, Option (true ), None )(request)
539+
540+ status(result) shouldBe OK
541+ println(contentAsString(result))
542+ contentAsString(result) should include(" Endpoints" )
543+ contentAsString(result) should not include (" Fraud Prevention" )
544+ }
509545 }
510546
511547 " display the not found page when invalid service specified" in new Setup {
0 commit comments