add rest api updateAllPlugins

This commit is contained in:
Eduard Heimbuch
2019-09-27 15:30:21 +02:00
parent 32cb67f92e
commit 281d812065
11 changed files with 99 additions and 2 deletions

View File

@@ -474,6 +474,39 @@ class DefaultPluginManagerTest {
Boolean lasUninstallMarkerSet = uninstallCaptor.getAllValues().get(uninstallCaptor.getAllValues().size() - 1);
assertThat(lasUninstallMarkerSet).isFalse();
}
@Test
void shouldUpdateAllPlugins() {
InstalledPlugin mailPlugin = createInstalled("scm-mail-plugin");
InstalledPlugin reviewPlugin = createInstalled("scm-review-plugin");
when(loader.getInstalledPlugins()).thenReturn(ImmutableList.of(mailPlugin, reviewPlugin));
AvailablePlugin newMailPlugin = createAvailable("scm-mail-plugin", "2.0.0");
AvailablePlugin newReviewPlugin = createAvailable("scm-review-plugin", "2.0.0");
when(center.getAvailable()).thenReturn(ImmutableSet.of(newMailPlugin, newReviewPlugin));
manager.updateAll(false);
verify(installer).install(newMailPlugin);
verify(installer).install(newReviewPlugin);
}
@Test
void shouldNotUpdateToOldPluginVersions() {
InstalledPlugin scriptPlugin = createInstalled("scm-script-plugin");
when(loader.getInstalledPlugins()).thenReturn(ImmutableList.of(scriptPlugin));
AvailablePlugin oldScriptPlugin = createAvailable("scm-script-plugin", "0.9");
when(center.getAvailable()).thenReturn(ImmutableSet.of(oldScriptPlugin));
manager.updateAll(false);
verify(installer, never()).install(oldScriptPlugin);
}
}
@Nested
@@ -533,5 +566,10 @@ class DefaultPluginManagerTest {
void shouldThrowAuthorizationExceptionsForCancelPending() {
assertThrows(AuthorizationException.class, () -> manager.cancelPending());
}
@Test
void shouldThrowAuthorizationExceptionsForUpdateAll() {
assertThrows(AuthorizationException.class, () -> manager.updateAll(false));
}
}
}