Skip to content

Commit

Permalink
Revert "refactor/Remove duplicated code"
Browse files Browse the repository at this point in the history
This reverts commit 57c1e74
  • Loading branch information
constantine2nd committed Sep 6, 2024
1 parent a6728bf commit ad1b102
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions obp-api/src/test/scala/code/api/v5_1_0/RegulatedEntityTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ class RegulatedEntityTest extends V510ServerSetup {
object VersionOfApi extends Tag(ApiVersion.v5_1_0.toString)
object ApiEndpoint1 extends Tag(nameOf(Implementations5_1_0.createRegulatedEntity))
object ApiEndpoint2 extends Tag(nameOf(Implementations5_1_0.getRegulatedEntityById))
object ApiEndpoint3 extends Tag(nameOf(Implementations5_1_0.deleteRegulatedEntity))

object ApiEndpoint3 extends Tag(nameOf(Implementations5_1_0.getRegulatedEntityById))
object ApiEndpoint4 extends Tag(nameOf(Implementations5_1_0.deleteRegulatedEntity))

feature(s"test $ApiEndpoint1 version $VersionOfApi - Unauthorized access") {
scenario("We will call the endpoint without user credentials", ApiEndpoint1, VersionOfApi) {
When("We make a request v5.1.0")
Expand All @@ -35,7 +36,7 @@ class RegulatedEntityTest extends V510ServerSetup {
response510.body.extract[ErrorMessage].message should equal(UserNotLoggedIn)
}
}

feature(s"test $ApiEndpoint1 version $VersionOfApi - Authorized access") {
scenario("We will call the endpoint with user credentials but without a proper entitlement", ApiEndpoint1, VersionOfApi) {
When("We make a request v5.1.0")
Expand All @@ -46,7 +47,7 @@ class RegulatedEntityTest extends V510ServerSetup {
response510.body.extract[ErrorMessage].message should be (UserHasMissingRoles + CanCreateRegulatedEntity)
}
}

feature(s"test $ApiEndpoint1 version $VersionOfApi - Authorized access") {
scenario("We will call the endpoint with user credentials and a proper entitlement", ApiEndpoint1, VersionOfApi) {
Entitlement.entitlement.vend.addEntitlement("", resourceUser1.userId, CanCreateRegulatedEntity.toString)
Expand All @@ -60,7 +61,7 @@ class RegulatedEntityTest extends V510ServerSetup {
}

// ApiEndpoint4 - deleteRegulatedEntity
feature(s"test $ApiEndpoint3 version $VersionOfApi - Unauthorized access") {
feature(s"test $ApiEndpoint4 version $VersionOfApi - Unauthorized access") {
scenario("We will call the endpoint without user credentials", ApiEndpoint1, VersionOfApi) {
When("We make a request v5.1.0")
val request510 = (v5_1_0_Request / "regulated-entities" / "some id").DELETE
Expand All @@ -70,7 +71,7 @@ class RegulatedEntityTest extends V510ServerSetup {
response510.body.extract[ErrorMessage].message should equal(UserNotLoggedIn)
}
}
feature(s"test $ApiEndpoint3 version $VersionOfApi - Authorized access") {
feature(s"test $ApiEndpoint4 version $VersionOfApi - Authorized access") {
scenario("We will call the endpoint with user credentials but without a proper entitlement", ApiEndpoint1, VersionOfApi) {
When("We make a request v5.1.0")
val request510 = (v5_1_0_Request / "regulated-entities" / "some id").DELETE <@ (user1)
Expand All @@ -82,7 +83,7 @@ class RegulatedEntityTest extends V510ServerSetup {
}


feature(s"test $ApiEndpoint1, $ApiEndpoint2, $ApiEndpoint3 version $VersionOfApi - CRUD") {
feature(s"test $ApiEndpoint1, $ApiEndpoint2, $ApiEndpoint3, $ApiEndpoint4 version $VersionOfApi - CRUD") {
scenario("We will call the endpoint with user credentials but without a proper entitlement", ApiEndpoint1, VersionOfApi) {
// Create a row
Entitlement.entitlement.vend.addEntitlement("", resourceUser1.userId, CanCreateRegulatedEntity.toString)
Expand Down

0 comments on commit ad1b102

Please sign in to comment.