Skip to content

Commit

Permalink
[JENKINS-34825] Fixed tests: only GLOBAL credentials should be availa…
Browse files Browse the repository at this point in the history
…ble from projects.
  • Loading branch information
Dohbedoh committed Feb 19, 2017
1 parent d71495f commit 70391d3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Expand Up @@ -33,7 +33,7 @@ abstract public class DefaultEnvironment {

protected P4PasswordImpl createCredentials(String user, String password, SampleServerRule p4d) throws IOException {
String p4port = p4d.getRshPort();
CredentialsScope scope = CredentialsScope.SYSTEM;
CredentialsScope scope = CredentialsScope.GLOBAL;
P4PasswordImpl auth = new P4PasswordImpl(scope, CREDENTIAL, "desc", p4port, null, user, "0", "0", null, password);
SystemCredentialsProvider.getInstance().getCredentials().clear();
SystemCredentialsProvider.getInstance().getCredentials().add(auth);
Expand Down
Expand Up @@ -73,11 +73,18 @@ public void testCredentialsList() throws Exception {
SCMDescriptor<?> desc = project.getScm().getDescriptor();
assertNotNull(desc);

// Dropdown should show 2 credentials: none and "id"
PerforceScm.DescriptorImpl impl = (DescriptorImpl) desc;
ListBoxModel list = impl.doFillCredentialItems(project, null);
assertTrue(list.size() == 1);
assertTrue(list.size() == 2);

FormValidation form = impl.doCheckCredential(project, CREDENTIAL);
list = impl.doFillCredentialItems(project, CREDENTIAL);
assertTrue(list.size() == 2);

FormValidation form = impl.doCheckCredential(project, null);
assertEquals(FormValidation.Kind.OK, form.kind);

form = impl.doCheckCredential(project, CREDENTIAL);
assertEquals(FormValidation.Kind.OK, form.kind);
}

Expand Down

0 comments on commit 70391d3

Please sign in to comment.