use of jenkins.plugins.nodejs.configfiles.NPMRegistry.DescriptorImpl in project nodejs-plugin by jenkinsci.
the class NPMRegistryValidatorTest method test_scopes_with_at_in_name.
@Test
public void test_scopes_with_at_in_name() throws Exception {
DescriptorImpl descriptor = new DescriptorImpl();
FormValidation result = descriptor.doCheckScopes(true, "@scope1");
assertThat(result.kind, is(Kind.WARNING));
assertThat(result.getMessage(), is(Messages.NPMRegistry_DescriptorImpl_invalidCharInScopes()));
}
use of jenkins.plugins.nodejs.configfiles.NPMRegistry.DescriptorImpl in project nodejs-plugin by jenkinsci.
the class NPMRegistryValidatorTest method test_invalid_credentials.
@Test
public void test_invalid_credentials() throws Exception {
FreeStyleProject prj = mock(FreeStyleProject.class);
when(prj.hasPermission(isA(Permission.class))).thenReturn(true);
DescriptorImpl descriptor = mock(DescriptorImpl.class);
when(descriptor.doCheckCredentialsId(any(Item.class), (String) any(), anyString())).thenCallRealMethod();
String credentialsId = "secret";
String serverURL = "http://acme.com";
FormValidation result = descriptor.doCheckCredentialsId(prj, credentialsId, serverURL);
assertThat(result.kind, is(Kind.ERROR));
assertThat(result.getMessage(), is(Messages.NPMRegistry_DescriptorImpl_invalidCredentialsId()));
when(prj.hasPermission(isA(Permission.class))).thenReturn(false);
result = descriptor.doCheckCredentialsId(prj, credentialsId, serverURL);
assertThat(result.kind, is(Kind.OK));
}
use of jenkins.plugins.nodejs.configfiles.NPMRegistry.DescriptorImpl in project nodejs-plugin by jenkinsci.
the class NPMRegistryValidatorTest method test_empty_server_url_is_ok.
@Test
public void test_empty_server_url_is_ok() throws Exception {
DescriptorImpl descriptor = new DescriptorImpl();
FormValidation result = descriptor.doCheckUrl("http://acme.com");
assertThat(result.kind, is(Kind.OK));
}
use of jenkins.plugins.nodejs.configfiles.NPMRegistry.DescriptorImpl in project nodejs-plugin by jenkinsci.
the class NPMRegistryValidatorTest method test_empty_credentials.
@Test
public void test_empty_credentials() throws Exception {
FreeStyleProject prj = mock(FreeStyleProject.class);
when(prj.hasPermission(isA(Permission.class))).thenReturn(true);
DescriptorImpl descriptor = mock(DescriptorImpl.class);
when(descriptor.doCheckCredentialsId(any(Item.class), (String) any(), anyString())).thenCallRealMethod();
String serverURL = "http://acme.com";
FormValidation result = descriptor.doCheckCredentialsId(prj, "", serverURL);
assertThat(result.kind, is(Kind.WARNING));
assertThat(result.getMessage(), is(Messages.NPMRegistry_DescriptorImpl_emptyCredentialsId()));
result = descriptor.doCheckCredentialsId(prj, null, serverURL);
assertThat(result.kind, is(Kind.WARNING));
assertThat(result.getMessage(), is(Messages.NPMRegistry_DescriptorImpl_emptyCredentialsId()));
}
use of jenkins.plugins.nodejs.configfiles.NPMRegistry.DescriptorImpl in project nodejs-plugin by jenkinsci.
the class NPMRegistryValidatorTest method test_empty_server_url.
@Test
public void test_empty_server_url() throws Exception {
DescriptorImpl descriptor = new DescriptorImpl();
FormValidation result = descriptor.doCheckUrl("");
assertThat(result.kind, is(Kind.ERROR));
assertThat(result.getMessage(), is(Messages.NPMRegistry_DescriptorImpl_emptyRegistryURL()));
}
Aggregations