mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-01-30 11:19:08 +01:00
add rest api updateAllPlugins
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user