From d0a5559c5b276653ff72fb19fc53b96069b6e8a2 Mon Sep 17 00:00:00 2001 From: ivinokur Date: Tue, 23 Jul 2024 17:16:37 +0300 Subject: [PATCH] Avoid using real tokens in unit test, even expired --- .../bitbucket/HttpBitbucketServerApiClientTest.java | 10 +++++----- .../rest/access-tokens/1.0/users/ksmster/newtoken.json | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/wsmaster/che-core-api-factory-bitbucket-server/src/test/java/org/eclipse/che/api/factory/server/bitbucket/HttpBitbucketServerApiClientTest.java b/wsmaster/che-core-api-factory-bitbucket-server/src/test/java/org/eclipse/che/api/factory/server/bitbucket/HttpBitbucketServerApiClientTest.java index 54cdf4d6147..5f7bb75fff3 100644 --- a/wsmaster/che-core-api-factory-bitbucket-server/src/test/java/org/eclipse/che/api/factory/server/bitbucket/HttpBitbucketServerApiClientTest.java +++ b/wsmaster/che-core-api-factory-bitbucket-server/src/test/java/org/eclipse/che/api/factory/server/bitbucket/HttpBitbucketServerApiClientTest.java @@ -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; @@ -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 @@ -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) diff --git a/wsmaster/che-core-api-factory-bitbucket-server/src/test/resources/__files/bitbucket/rest/access-tokens/1.0/users/ksmster/newtoken.json b/wsmaster/che-core-api-factory-bitbucket-server/src/test/resources/__files/bitbucket/rest/access-tokens/1.0/users/ksmster/newtoken.json index dc41054388c..6fc0a8357ba 100644 --- a/wsmaster/che-core-api-factory-bitbucket-server/src/test/resources/__files/bitbucket/rest/access-tokens/1.0/users/ksmster/newtoken.json +++ b/wsmaster/che-core-api-factory-bitbucket-server/src/test/resources/__files/bitbucket/rest/access-tokens/1.0/users/ksmster/newtoken.json @@ -23,5 +23,5 @@ ] } }, - "token": "MTU4OTEwNTMyOTA5Ohc88HcY8k7gWOzl2mP5TtdtY5Qs" -} \ No newline at end of file + "token": "token" +}