mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-02-27 00:40:51 +01:00
Integrate Plugin Center myCloudogu Authentication (#1884)
Allows scm-manager instances to authenticate with the configured plugin center. If the default plugin center is used, a myCloudogu account is used for authentication which in turn enables downloading special myCloudogu plugins directly through the plugin administration page. Co-authored-by: Konstantin Schaper <konstantin.schaper@cloudogu.com> Co-authored-by: Matthias Thieroff <93515444+mthieroff@users.noreply.github.com> Co-authored-by: Philipp Ahrendt <philipp.ahrendt@cloudogu.com>
This commit is contained in:
@@ -45,6 +45,7 @@ import java.util.Set;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
@@ -86,6 +87,7 @@ class PluginCenterTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
void shouldCache() {
|
||||
Set<AvailablePlugin> first = new HashSet<>();
|
||||
when(loader.load(anyString())).thenReturn(first, new HashSet<>());
|
||||
@@ -94,4 +96,25 @@ class PluginCenterTest {
|
||||
assertThat(pluginCenter.getAvailable()).isSameAs(first);
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
void shouldClearCache() {
|
||||
Set<AvailablePlugin> first = new HashSet<>();
|
||||
when(loader.load(anyString())).thenReturn(first, new HashSet<>());
|
||||
|
||||
assertThat(pluginCenter.getAvailable()).isSameAs(first);
|
||||
pluginCenter.handle(new PluginCenterLoginEvent(null));
|
||||
assertThat(pluginCenter.getAvailable()).isNotSameAs(first);
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldLoadOnRefresh() {
|
||||
Set<AvailablePlugin> plugins = new HashSet<>();
|
||||
when(loader.load(PLUGIN_URL_BASE + "2.0.0")).thenReturn(plugins);
|
||||
|
||||
pluginCenter.refresh();
|
||||
|
||||
verify(loader).load(PLUGIN_URL_BASE + "2.0.0");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user