summaryrefslogtreecommitdiffstats
path: root/apps/provisioning_api/tests
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-05-07 17:56:13 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2015-05-07 17:56:13 +0200
commit15d134124bde5fa8693c640a3db000a9bc47d51f (patch)
tree6350883bd7de85ac4b9e07e3b5124bd6ee2a5890 /apps/provisioning_api/tests
parent9f2f2821919ed770fd4ede17f27a22d6c17dc374 (diff)
downloadnextcloud-server-15d134124bde5fa8693c640a3db000a9bc47d51f.tar.gz
nextcloud-server-15d134124bde5fa8693c640a3db000a9bc47d51f.zip
Validate the quota value to be a correct value
Diffstat (limited to 'apps/provisioning_api/tests')
-rw-r--r--apps/provisioning_api/tests/userstest.php30
1 files changed, 23 insertions, 7 deletions
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() {