Skip to content

Commit

Permalink
fix: increase token expiry time in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
anku255 committed Jun 18, 2024
1 parent c020e77 commit a7483bc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1104,7 +1104,7 @@ public void doAction(HttpURLConnection con) throws IOException {

@Test
public void httpUrlConnection_shouldNotRefreshLoopWhenExpiredTokenPassedInHeadersBeforeDoAction() throws Exception{
com.example.TestUtils.startST(1, true, 144000);
com.example.TestUtils.startST(3, true, 144000);
new SuperTokens.Builder(context, Constants.apiDomain).build();

//login request
Expand Down Expand Up @@ -1132,7 +1132,7 @@ public void doAction(HttpURLConnection con) throws IOException {
loginRequestConnection.disconnect();

// wait for access token expiry
Thread.sleep(2000);
Thread.sleep(4000);

String expiredAccessToken = Utils.getTokenForHeaderAuth(Utils.TokenType.ACCESS, context);

Expand Down Expand Up @@ -1163,7 +1163,7 @@ public void doAction(HttpURLConnection con) throws IOException {

@Test
public void httpUrlConnection_shouldNotRefreshLoopWhenExpiredTokenRetrievedInsideDoAction() throws Exception{
com.example.TestUtils.startST(1, true, 144000);
com.example.TestUtils.startST(3, true, 144000);
new SuperTokens.Builder(context, Constants.apiDomain).build();

//login request
Expand Down Expand Up @@ -1191,7 +1191,7 @@ public void doAction(HttpURLConnection con) throws IOException {
loginRequestConnection.disconnect();

// wait for access token expiry
Thread.sleep(2000);
Thread.sleep(4000);

int sessionRefreshCalledCount = com.example.TestUtils.getRefreshTokenCounter();
if (sessionRefreshCalledCount != 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1220,7 +1220,7 @@ public void okhttpHeaders_testShouldNotDoSessionRefreshIfMaxRetryAttemptsForSess

@Test
public void okHttpHeaders_shouldNotEndUpInRefreshLoopIfExpiredAccessTokenWasPassedInHeaders() throws Exception {
com.example.TestUtils.startST(1, true, 144000);
com.example.TestUtils.startST(3, true, 144000);
new SuperTokens.Builder(context, Constants.apiDomain)
.build();
JsonObject bodyJson = new JsonObject();
Expand All @@ -1239,7 +1239,7 @@ public void okHttpHeaders_shouldNotEndUpInRefreshLoopIfExpiredAccessTokenWasPass
loginResponse.close();

// wait for the token to expire
Thread.sleep(2000);
Thread.sleep(4000);

int sessionRefreshCalledCount = com.example.TestUtils.getRefreshTokenCounter();
if (sessionRefreshCalledCount != 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ public void retrofitHeaders_testShouldNotDoSessionRefreshIfMaxRetryAttemptsForSe

@Test
public void retrofitHeaders_shouldNotEndUpInRefreshLoopIfExpiredAccessTokenWasPassedInHeaders() throws Exception {
com.example.TestUtils.startST(1, true, 144000);
com.example.TestUtils.startST(3, true, 144000);
new SuperTokens.Builder(context, Constants.apiDomain)
.build();

Expand All @@ -833,7 +833,7 @@ public void retrofitHeaders_shouldNotEndUpInRefreshLoopIfExpiredAccessTokenWasPa
}

// wait for the token to expire
Thread.sleep(2000);
Thread.sleep(4000);

int sessionRefreshCalledCount = com.example.TestUtils.getRefreshTokenCounter();
if (sessionRefreshCalledCount != 0) {
Expand Down

0 comments on commit a7483bc

Please sign in to comment.