mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-07-04 09:49:26 +02:00
Add uninstalled plugins to pending resource
This commit is contained in:
@@ -30,6 +30,7 @@ import java.io.UnsupportedEncodingException;
|
||||
import java.net.URISyntaxException;
|
||||
|
||||
import static java.net.URI.create;
|
||||
import static java.util.Collections.emptyList;
|
||||
import static java.util.Collections.singletonList;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
@@ -123,7 +124,6 @@ class PendingPluginResourceTest {
|
||||
assertThat(response.getStatus()).isEqualTo(HttpServletResponse.SC_OK);
|
||||
assertThat(response.getContentAsString()).contains("\"new\":[{\"name\":\"pending-available-plugin\"");
|
||||
assertThat(response.getContentAsString()).contains("\"install\":{\"href\":\"/v2/plugins/pending/install\"}");
|
||||
System.out.println(response.getContentAsString());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -140,7 +140,21 @@ class PendingPluginResourceTest {
|
||||
assertThat(response.getStatus()).isEqualTo(HttpServletResponse.SC_OK);
|
||||
assertThat(response.getContentAsString()).contains("\"update\":[{\"name\":\"available-plugin\"");
|
||||
assertThat(response.getContentAsString()).contains("\"install\":{\"href\":\"/v2/plugins/pending/install\"}");
|
||||
System.out.println(response.getContentAsString());
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldGetPendingUninstallPluginListWithInstallLink() throws URISyntaxException, UnsupportedEncodingException {
|
||||
when(pluginManager.getAvailable()).thenReturn(emptyList());
|
||||
InstalledPlugin installedPlugin = createInstalledPlugin("uninstalled-plugin");
|
||||
when(installedPlugin.isMarkedForUninstall()).thenReturn(true);
|
||||
when(pluginManager.getInstalled()).thenReturn(singletonList(installedPlugin));
|
||||
|
||||
MockHttpRequest request = MockHttpRequest.get("/v2/plugins/pending");
|
||||
dispatcher.invoke(request, response);
|
||||
|
||||
assertThat(response.getStatus()).isEqualTo(HttpServletResponse.SC_OK);
|
||||
assertThat(response.getContentAsString()).contains("\"uninstall\":[{\"name\":\"uninstalled-plugin\"");
|
||||
assertThat(response.getContentAsString()).contains("\"install\":{\"href\":\"/v2/plugins/pending/install\"}");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user