update CHANGELOG.md // adjust unit tests to changed permission

This commit is contained in:
Eduard Heimbuch
2020-05-05 11:15:26 +02:00
parent 63e5d2f23d
commit f3d289546e
5 changed files with 14 additions and 13 deletions

View File

@@ -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

View File

@@ -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");

View File

@@ -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);

View File

@@ -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