mirror of
https://github.com/OpenBankProject/OBP-API.git
synced 2026-02-06 13:07:02 +00:00
test/Add test for endpoint accountCurrencyCheck v5.1.0
This commit is contained in:
parent
3047f74027
commit
741ee28885
@ -22,6 +22,7 @@ class SystemIntegrityTest extends V510ServerSetup {
|
||||
object ApiEndpoint1 extends Tag(nameOf(Implementations5_1_0.customViewNamesCheck))
|
||||
object ApiEndpoint2 extends Tag(nameOf(Implementations5_1_0.systemViewNamesCheck))
|
||||
object ApiEndpoint3 extends Tag(nameOf(Implementations5_1_0.accountAccessUniqueIndexCheck))
|
||||
object ApiEndpoint4 extends Tag(nameOf(Implementations5_1_0.accountCurrencyCheck))
|
||||
|
||||
feature(s"test $ApiEndpoint1 version $VersionOfApi - Unauthorized access") {
|
||||
scenario("We will call the endpoint without user credentials", ApiEndpoint1, VersionOfApi) {
|
||||
@ -128,5 +129,41 @@ class SystemIntegrityTest extends V510ServerSetup {
|
||||
response510.body.extract[CheckSystemIntegrityJsonV510]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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 / "management" / "system" / "integrity" / "account-currency-check").GET
|
||||
val response510 = makeGetRequest(request510)
|
||||
Then("We should get a 401")
|
||||
response510.code should equal(401)
|
||||
response510.body.extract[ErrorMessage].message should equal(UserNotLoggedIn)
|
||||
}
|
||||
}
|
||||
|
||||
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 / "management" / "system" / "integrity" / "account-currency-check").GET <@(user1)
|
||||
val response510 = makeGetRequest(request510)
|
||||
Then("error should be " + UserHasMissingRoles + CanGetSystemIntegrity)
|
||||
response510.code should equal(403)
|
||||
response510.body.extract[ErrorMessage].message should be (UserHasMissingRoles + CanGetSystemIntegrity)
|
||||
}
|
||||
}
|
||||
|
||||
feature(s"test $ApiEndpoint4 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, CanGetSystemIntegrity.toString)
|
||||
When("We make a request v5.1.0")
|
||||
val request510 = (v5_1_0_Request / "management" / "system" / "integrity" / "account-currency-check").GET <@(user1)
|
||||
val response510 = makeGetRequest(request510)
|
||||
Then("We get successful response")
|
||||
response510.code should equal(200)
|
||||
response510.body.extract[CheckSystemIntegrityJsonV510]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user