diff options
author | Joas Schilling <coding@schilljs.com> | 2021-04-21 08:58:35 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2021-05-12 08:16:07 +0200 |
commit | b6c6527705695a343b055f89bdde5ec497914ff1 (patch) | |
tree | b52adc3a0b203add9a971cd1e2bf0ef9666af23a /apps/provisioning_api/tests | |
parent | 0599a8060ceb6518bb3981c88fc14f215d80f562 (diff) | |
download | nextcloud-server-b6c6527705695a343b055f89bdde5ec497914ff1.tar.gz nextcloud-server-b6c6527705695a343b055f89bdde5ec497914ff1.zip |
Fix unauthorized OCS status in provisioning
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/provisioning_api/tests')
-rw-r--r-- | apps/provisioning_api/tests/Controller/UsersControllerTest.php | 16 | ||||
-rw-r--r-- | apps/provisioning_api/tests/Middleware/ProvisioningApiMiddlewareTest.php | 4 |
2 files changed, 10 insertions, 10 deletions
diff --git a/apps/provisioning_api/tests/Controller/UsersControllerTest.php b/apps/provisioning_api/tests/Controller/UsersControllerTest.php index 1afe9be4319..d95edff8625 100644 --- a/apps/provisioning_api/tests/Controller/UsersControllerTest.php +++ b/apps/provisioning_api/tests/Controller/UsersControllerTest.php @@ -1208,7 +1208,7 @@ class UsersControllerTest extends TestCase { public function testGetUserDataAsSubAdminAndUserIsNotAccessible() { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); - $this->expectExceptionCode(997); + $this->expectExceptionCode(998); $loggedInUser = $this->getMockBuilder(IUser::class) ->disableOriginalConstructor() @@ -1681,7 +1681,7 @@ class UsersControllerTest extends TestCase { public function testEditUserRegularUserSelfEditChangeQuota() { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); - $this->expectExceptionCode(997); + $this->expectExceptionCode(103); $loggedInUser = $this->getMockBuilder(IUser::class) ->disableOriginalConstructor() @@ -1759,7 +1759,7 @@ class UsersControllerTest extends TestCase { public function testEditUserAdminUserSelfEditChangeInvalidQuota() { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); $this->expectExceptionMessage('Invalid quota value ABC'); - $this->expectExceptionCode(103); + $this->expectExceptionCode(102); $loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock(); $loggedInUser @@ -2091,7 +2091,7 @@ class UsersControllerTest extends TestCase { public function testEditUserSubadminUserInaccessible() { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); - $this->expectExceptionCode(997); + $this->expectExceptionCode(998); $loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock(); $loggedInUser @@ -2131,7 +2131,7 @@ class UsersControllerTest extends TestCase { public function testDeleteUserNotExistingUser() { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); - $this->expectExceptionCode(101); + $this->expectExceptionCode(998); $loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock(); $loggedInUser @@ -2344,7 +2344,7 @@ class UsersControllerTest extends TestCase { public function testDeleteUserAsSubAdminAndUserIsNotAccessible() { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); - $this->expectExceptionCode(997); + $this->expectExceptionCode(998); $loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock(); $loggedInUser @@ -2525,7 +2525,7 @@ class UsersControllerTest extends TestCase { public function testGetUsersGroupsForSubAdminUserAndUserIsInaccessible() { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); - $this->expectExceptionCode(997); + $this->expectExceptionCode(998); $loggedInUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock(); $loggedInUser @@ -3526,7 +3526,7 @@ class UsersControllerTest extends TestCase { public function testResendWelcomeMessageAsSubAdminAndUserIsNotAccessible() { $this->expectException(\OCP\AppFramework\OCS\OCSException::class); - $this->expectExceptionCode(997); + $this->expectExceptionCode(998); $loggedInUser = $this->getMockBuilder(IUser::class) ->disableOriginalConstructor() diff --git a/apps/provisioning_api/tests/Middleware/ProvisioningApiMiddlewareTest.php b/apps/provisioning_api/tests/Middleware/ProvisioningApiMiddlewareTest.php index 4565bde42a2..1977a4aa0f9 100644 --- a/apps/provisioning_api/tests/Middleware/ProvisioningApiMiddlewareTest.php +++ b/apps/provisioning_api/tests/Middleware/ProvisioningApiMiddlewareTest.php @@ -27,8 +27,8 @@ namespace OCA\Provisioning_API\Tests\Middleware; use OCA\Provisioning_API\Middleware\Exceptions\NotSubAdminException; use OCA\Provisioning_API\Middleware\ProvisioningApiMiddleware; use OCP\AppFramework\Controller; +use OCP\AppFramework\Http; use OCP\AppFramework\OCS\OCSException; -use OCP\AppFramework\OCSController; use OCP\AppFramework\Utility\IControllerMethodReflector; use Test\TestCase; @@ -115,7 +115,7 @@ class ProvisioningApiMiddlewareTest extends TestCase { } catch (OCSException $e) { $this->assertFalse($forwared); $this->assertSame($exception->getMessage(), $e->getMessage()); - $this->assertSame(OCSController::RESPOND_UNAUTHORISED, $e->getCode()); + $this->assertSame(Http::STATUS_FORBIDDEN, $e->getCode()); } catch (\Exception $e) { $this->assertTrue($forwared); $this->assertSame($exception, $e); |