mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-13 00:45:44 +01:00
update CHANGELOG.md // adjust unit tests to changed permission
This commit is contained in:
@@ -114,7 +114,7 @@ class PendingPluginResourceTest {
|
||||
@BeforeEach
|
||||
void bindSubject() {
|
||||
ThreadContext.bind(subject);
|
||||
lenient().when(subject.isPermitted("plugin:manage")).thenReturn(true);
|
||||
lenient().when(subject.isPermitted("plugin:write")).thenReturn(true);
|
||||
lenient().when(restarter.isSupported()).thenReturn(true);
|
||||
}
|
||||
|
||||
@@ -228,7 +228,7 @@ class PendingPluginResourceTest {
|
||||
@BeforeEach
|
||||
void bindSubject() {
|
||||
ThreadContext.bind(subject);
|
||||
when(subject.isPermitted("plugin:manage")).thenReturn(false);
|
||||
when(subject.isPermitted("plugin:write")).thenReturn(false);
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
|
||||
@@ -119,7 +119,7 @@ class PluginDtoCollectionMapperTest {
|
||||
|
||||
@Test
|
||||
void shouldNotAddInstallLinkForNewVersionWhenNotPermitted() {
|
||||
when(subject.isPermitted("plugin:manage")).thenReturn(false);
|
||||
when(subject.isPermitted("plugin:write")).thenReturn(false);
|
||||
PluginDtoCollectionMapper mapper = new PluginDtoCollectionMapper(resourceLinks, pluginDtoMapper, manager);
|
||||
|
||||
HalRepresentation result = mapper.mapInstalled(
|
||||
@@ -132,7 +132,7 @@ class PluginDtoCollectionMapperTest {
|
||||
|
||||
@Test
|
||||
void shouldNotAddInstallLinkForNewVersionWhenInstallationIsPending() {
|
||||
when(subject.isPermitted("plugin:manage")).thenReturn(true);
|
||||
when(subject.isPermitted("plugin:write")).thenReturn(true);
|
||||
PluginDtoCollectionMapper mapper = new PluginDtoCollectionMapper(resourceLinks, pluginDtoMapper, manager);
|
||||
|
||||
AvailablePlugin availablePlugin = createAvailablePlugin("scm-some-plugin", "2");
|
||||
@@ -147,7 +147,7 @@ class PluginDtoCollectionMapperTest {
|
||||
|
||||
@Test
|
||||
void shouldAddUpdateLinkForNewVersionWhenPermitted() {
|
||||
when(subject.isPermitted("plugin:manage")).thenReturn(true);
|
||||
when(subject.isPermitted("plugin:write")).thenReturn(true);
|
||||
PluginDtoCollectionMapper mapper = new PluginDtoCollectionMapper(resourceLinks, pluginDtoMapper, manager);
|
||||
|
||||
HalRepresentation result = mapper.mapInstalled(
|
||||
@@ -161,7 +161,7 @@ class PluginDtoCollectionMapperTest {
|
||||
@Test
|
||||
void shouldAddUpdateWithRestartLinkForNewVersionWhenPermitted() {
|
||||
when(restarter.isSupported()).thenReturn(true);
|
||||
when(subject.isPermitted("plugin:manage")).thenReturn(true);
|
||||
when(subject.isPermitted("plugin:write")).thenReturn(true);
|
||||
PluginDtoCollectionMapper mapper = new PluginDtoCollectionMapper(resourceLinks, pluginDtoMapper, manager);
|
||||
|
||||
HalRepresentation result = mapper.mapInstalled(
|
||||
@@ -175,7 +175,7 @@ class PluginDtoCollectionMapperTest {
|
||||
|
||||
@Test
|
||||
void shouldSetInstalledPluginPendingWhenCorrespondingAvailablePluginIsPending() {
|
||||
when(subject.isPermitted("plugin:manage")).thenReturn(true);
|
||||
when(subject.isPermitted("plugin:write")).thenReturn(true);
|
||||
PluginDtoCollectionMapper mapper = new PluginDtoCollectionMapper(resourceLinks, pluginDtoMapper, manager);
|
||||
|
||||
AvailablePlugin availablePlugin = createAvailablePlugin("scm-some-plugin", "2");
|
||||
|
||||
@@ -127,7 +127,7 @@ class PluginDtoMapperTest {
|
||||
|
||||
@Test
|
||||
void shouldAppendInstallLink() {
|
||||
when(subject.isPermitted("plugin:manage")).thenReturn(true);
|
||||
when(subject.isPermitted("plugin:write")).thenReturn(true);
|
||||
AvailablePlugin plugin = createAvailable(createPluginInformation());
|
||||
|
||||
PluginDto dto = mapper.mapAvailable(plugin);
|
||||
@@ -138,7 +138,7 @@ class PluginDtoMapperTest {
|
||||
@Test
|
||||
void shouldAppendInstallWithRestartLink() {
|
||||
when(restarter.isSupported()).thenReturn(true);
|
||||
when(subject.isPermitted("plugin:manage")).thenReturn(true);
|
||||
when(subject.isPermitted("plugin:write")).thenReturn(true);
|
||||
AvailablePlugin plugin = createAvailable(createPluginInformation());
|
||||
|
||||
PluginDto dto = mapper.mapAvailable(plugin);
|
||||
@@ -166,7 +166,7 @@ class PluginDtoMapperTest {
|
||||
|
||||
@Test
|
||||
void shouldAppendUninstallLink() {
|
||||
when(subject.isPermitted("plugin:manage")).thenReturn(true);
|
||||
when(subject.isPermitted("plugin:write")).thenReturn(true);
|
||||
InstalledPlugin plugin = createInstalled(createPluginInformation());
|
||||
when(plugin.isUninstallable()).thenReturn(true);
|
||||
|
||||
@@ -178,7 +178,7 @@ class PluginDtoMapperTest {
|
||||
@Test
|
||||
void shouldAppendUninstallWithRestartLink() {
|
||||
when(restarter.isSupported()).thenReturn(true);
|
||||
when(subject.isPermitted("plugin:manage")).thenReturn(true);
|
||||
when(subject.isPermitted("plugin:write")).thenReturn(true);
|
||||
|
||||
InstalledPlugin plugin = createInstalled(createPluginInformation());
|
||||
when(plugin.isUninstallable()).thenReturn(true);
|
||||
|
||||
@@ -602,12 +602,12 @@ class DefaultPluginManagerTest {
|
||||
}
|
||||
|
||||
@Nested
|
||||
class WithoutManagePermissions {
|
||||
class WithoutWritePermissions {
|
||||
|
||||
@BeforeEach
|
||||
void setUpSubject() {
|
||||
ThreadContext.bind(subject);
|
||||
doThrow(AuthorizationException.class).when(subject).checkPermission("plugin:manage");
|
||||
doThrow(AuthorizationException.class).when(subject).checkPermission("plugin:write");
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
|
||||
Reference in New Issue
Block a user