From 15d134124bde5fa8693c640a3db000a9bc47d51f Mon Sep 17 00:00:00 2001 From: Thomas Müller Date: Thu, 7 May 2015 17:56:13 +0200 Subject: Validate the quota value to be a correct value --- apps/provisioning_api/tests/userstest.php | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) (limited to 'apps/provisioning_api/tests') diff --git a/apps/provisioning_api/tests/userstest.php b/apps/provisioning_api/tests/userstest.php index b7e83a3c4fe..c6a6133b7d2 100644 --- a/apps/provisioning_api/tests/userstest.php +++ b/apps/provisioning_api/tests/userstest.php @@ -187,20 +187,36 @@ class UsersTest extends TestCase { } - public function testEditOwnQuota() { + /** + * @dataProvider providesQuotas + * @param $expected + * @param $quota + */ + public function testEditOwnQuota($expected, $quota) { $user = $this->generateUsers(); + \OC_Group::addToGroup($user, 'admin'); \OC_User::setUserId($user); $result = \OCA\provisioning_API\Users::editUser( - array( + [ 'userid' => $user, - '_put' => array( + '_put' => [ 'key' => 'quota', - 'value' => '20G', - ), - ) + 'value' => $quota, + ], + ] ); $this->assertInstanceOf('OC_OCS_Result', $result); - $this->assertFalse($result->succeeded()); + $this->assertEquals($expected, $result->succeeded()); + } + + public function providesQuotas() { + return [ + [true, '20G'], + [true, '1234567'], + [true, 'none'], + [true, 'default'], + [false, 'qwertzu'], + ]; } public function testAdminEditOwnQuota() { -- cgit v1.2.3