Skip to content

Commit

Permalink
Merge pull request #66 from yaroslavafenkin/JENKINS-72611-cleanup
Browse files Browse the repository at this point in the history
Clean up after #65
  • Loading branch information
jtnord authored Mar 4, 2024
2 parents b231f25 + 590ccbe commit c5cb98f
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void setup(){
@Test
public void secretTextBaseTest() throws IOException {
StringCredentialsImpl credential = new StringCredentialsImpl(CredentialsScope.GLOBAL, CRED_ID, "Test Secret Text", Secret.fromString("password"));
StringCredentialsImpl updatedCredential = new StringCredentialsImpl(credential.getScope(), CRED_ID, credential.getDescription(), credential.getSecret());
StringCredentialsImpl updatedCredential = new StringCredentialsImpl(credential.getScope(), CRED_ID, "Updated Secret Text", credential.getSecret());
testCreateUpdateDelete(credential, updatedCredential);
}

Expand All @@ -74,7 +74,7 @@ private void secretFileTest(boolean useDeprecatedConstructor) throws IOException
credential = new FileCredentialsImpl(CredentialsScope.GLOBAL, CRED_ID, "Test Secret file", fileItem, "keys.txt", SecretBytes.fromBytes(fileItem.get()));
}

FileCredentialsImpl updatedCredential = new FileCredentialsImpl(credential.getScope(), CRED_ID, credential.getDescription(), fileItem, credential.getFileName(), credential.getSecretBytes());
FileCredentialsImpl updatedCredential = new FileCredentialsImpl(credential.getScope(), CRED_ID, "Updated Secret File", fileItem, credential.getFileName(), credential.getSecretBytes());
testCreateUpdateDelete(credential, updatedCredential);
}

Expand Down Expand Up @@ -103,11 +103,12 @@ private <T extends BaseStandardCredentials> void testCreateUpdateDelete(T creden
// Look up all credentials again
credentials = CredentialsProvider.lookupCredentials(BaseStandardCredentials.class, r.jenkins, ACL.SYSTEM, Collections.<DomainRequirement>emptyList());

// There is still 1 credential but the ID has been updated
// There is still 1 credential but the description has been updated
assertThat(credentials.size(), is(1));
cred = credentials.get(0);
assertThat(cred, instanceOf(credential.getClass()));
assertThat(cred.getId(), is(CRED_ID));
assertThat(cred.getDescription(), is(updatedCredential.getDescription()));

// Delete credential
store.removeCredentials(Domain.global(), cred);
Expand Down

0 comments on commit c5cb98f

Please sign in to comment.