use of com.cloudbees.plugins.credentials.domains.DomainCredentials in project configuration-as-code-plugin by jenkinsci.
the class GitLabConfigurationTest method configure_gitlab_api_token.
@Test
@ConfiguredWithReadme("gitlab/README.md")
public void configure_gitlab_api_token() {
SystemCredentialsProvider systemCreds = SystemCredentialsProvider.getInstance();
List<DomainCredentials> domainCredentials = systemCreds.getDomainCredentials();
assertEquals(1, domainCredentials.size());
final DomainCredentials gitLabCredential = domainCredentials.get(0);
assertEquals(Domain.global(), gitLabCredential.getDomain());
assertEquals(1, gitLabCredential.getCredentials().size());
final GitLabApiToken apiToken = (GitLabApiToken) gitLabCredential.getCredentials().get(0);
assertEquals("gitlab_token", apiToken.getId());
assertEquals("qwertyuiopasdfghjklzxcvbnm", apiToken.getApiToken().getPlainText());
assertEquals("Gitlab Token", apiToken.getDescription());
}
Aggregations