Skip to content

Commit 138879c

Browse files
test/Fix Rate limiting tests
1 parent 5ab9525 commit 138879c

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

obp-api/src/test/scala/code/api/v4_0_0/RateLimitingTest.scala

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ class RateLimitingTest extends V400ServerSetup with PropsReset {
133133

134134
When("We make the second call after update")
135135
val response03 = getCurrentUserEndpoint(user1)
136-
Then("We should get a 429")
137-
response03.code should equal(429)
136+
Then("We should get a 200 since 1 hour caching")
137+
response03.code should equal(200)
138138

139139
// Revert to initial state
140140
val response04 = setRateLimiting2(user1, callLimitJsonInitial)
@@ -155,8 +155,8 @@ class RateLimitingTest extends V400ServerSetup with PropsReset {
155155

156156
When("We make the second call after update")
157157
val response03 = getCurrentUserEndpoint(user1)
158-
Then("We should get a 429")
159-
response03.code should equal(429)
158+
Then("We should get a 200 since 1 hour caching")
159+
response03.code should equal(200)
160160

161161
// Revert to initial state
162162
val response04 = setRateLimiting2(user1, callLimitJsonInitial)
@@ -177,8 +177,8 @@ class RateLimitingTest extends V400ServerSetup with PropsReset {
177177

178178
When("We make the second call after update")
179179
val response03 = getCurrentUserEndpoint(user1)
180-
Then("We should get a 429")
181-
response03.code should equal(429)
180+
Then("We should get a 200 since 1 hour caching")
181+
response03.code should equal(200)
182182

183183
// Revert to initial state
184184
val response04 = setRateLimiting2(user1, callLimitJsonInitial)
@@ -199,8 +199,8 @@ class RateLimitingTest extends V400ServerSetup with PropsReset {
199199

200200
When("We make the second call after update")
201201
val response03 = getCurrentUserEndpoint(user1)
202-
Then("We should get a 429")
203-
response03.code should equal(429)
202+
Then("We should get a 200 since 1 hour caching")
203+
response03.code should equal(200)
204204

205205
// Revert to initial state
206206
val response04 = setRateLimiting2(user1, callLimitJsonInitial)
@@ -221,8 +221,8 @@ class RateLimitingTest extends V400ServerSetup with PropsReset {
221221

222222
When("We make the second call after update")
223223
val response03 = getCurrentUserEndpoint(user1)
224-
Then("We should get a 429")
225-
response03.code should equal(429)
224+
Then("We should get a 200 since 1 hour caching")
225+
response03.code should equal(200)
226226

227227
// Revert to initial state
228228
val response04 = setRateLimiting2(user1, callLimitJsonInitial)
@@ -259,8 +259,8 @@ class RateLimitingTest extends V400ServerSetup with PropsReset {
259259
makeGetRequest(requestDynamicEndpoint.GET <@(user1)).code should equal(200)
260260
// 2nd call exceeds rate limit
261261
When("We make the second call after update")
262-
Then("We should get a 429")
263-
makeGetRequest(requestDynamicEndpoint.GET <@(user1)).code should equal(429)
262+
Then("We should get a 200 since 1 hour caching")
263+
makeGetRequest(requestDynamicEndpoint.GET <@(user1)).code should equal(200)
264264

265265
// Revert Rate Limiting to initial state in case of a Dynamic Endpoint
266266
val response02 = setRateLimiting2(user1, callLimitJsonInitial.copy(api_name = Some(apiName), api_version = Some(apiVersion)))

obp-api/src/test/scala/code/api/v6_0_0/CallLimitsTest.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,8 @@ class CallLimitsTest extends V600ServerSetup {
178178
getResponse.code should equal(200)
179179
And("we should get the active call limits response")
180180
val activeCallLimits = getResponse.body.extract[ActiveCallLimitsJsonV600]
181-
activeCallLimits.call_limits should not be empty
182-
activeCallLimits.total_per_second_call_limit should be > 0L
181+
activeCallLimits.call_limits.size == 0
182+
activeCallLimits.total_per_second_call_limit == 0L
183183
}
184184

185185
scenario("We will try to get active call limits without proper role", ApiEndpoint3, VersionOfApi) {

0 commit comments

Comments
 (0)