Skip to content

Commit

Permalink
Avoid using real tokens in unit test, even expired (#707)
Browse files Browse the repository at this point in the history
  • Loading branch information
vinokurig authored Jul 29, 2024
1 parent fb0178f commit 14340a1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@
@Listeners(MockitoTestNGListener.class)
public class HttpBitbucketServerApiClientTest {
private final String AUTHORIZATION_TOKEN =
"OAuth oauth_consumer_key=\"key123321\", oauth_nonce=\"6c0eace252f8dcda\","
+ " oauth_signature=\"dPCm521TAF56FfGxabBAZDs9YTNeCg%2BiRK49afoJve8Mxk5ILlfkZKH693udqOig5k5ydeVxX%2FTso%2Flxx1pv2bqdbCqj3Nq82do1hJN5eTDLSvbHfGvjFuOGRobHTHwP6oJkaBSafjMUY8i8Vnz6hLfxToPj2ktd6ug4nKc1WGg%3D\", "
"OAuth oauth_consumer_key=\"key123321\", oauth_nonce=\"nonce\","
+ " oauth_signature=\"signature\", "
+ "oauth_signature_method=\"RSA-SHA1\", oauth_timestamp=\"1609250025\", "
+ "oauth_token=\"JmpyDe9sgYNn6pYHP6eGLaIU0vxdKLCJ\", oauth_version=\"1.0\"";
+ "oauth_token=\"token\", oauth_version=\"1.0\"";
WireMockServer wireMockServer;
WireMock wireMock;
BitbucketServerApiClient bitbucketServer;
Expand Down Expand Up @@ -276,7 +276,7 @@ public void shouldBeAbleToCreatePAT()
"myToKen", ImmutableSet.of("PROJECT_WRITE", "REPO_WRITE"));
// then
assertNotNull(result);
assertEquals(result.getToken(), "MTU4OTEwNTMyOTA5Ohc88HcY8k7gWOzl2mP5TtdtY5Qs");
assertEquals(result.getToken(), "token");
}

@Test
Expand Down Expand Up @@ -331,7 +331,7 @@ public void shouldBeAbleToGetExistedPAT()
BitbucketPersonalAccessToken result = bitbucketServer.getPersonalAccessToken("5", "token");
// then
assertNotNull(result);
assertEquals(result.getToken(), "MTU4OTEwNTMyOTA5Ohc88HcY8k7gWOzl2mP5TtdtY5Qs");
assertEquals(result.getToken(), "token");
}

@Test(expectedExceptions = ScmItemNotFoundException.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@
]
}
},
"token": "MTU4OTEwNTMyOTA5Ohc88HcY8k7gWOzl2mP5TtdtY5Qs"
}
"token": "token"
}

0 comments on commit 14340a1

Please sign in to comment.