More fixed tests :)

This commit is contained in:
Arthur Schiwon 2016-02-09 18:11:30 +01:00
parent 096115870c
commit d19c47a381
2 changed files with 45 additions and 40 deletions

View File

@ -1015,6 +1015,9 @@ class UsersTest extends OriginalTest {
->method('getUID') ->method('getUID')
->will($this->returnValue('UserToEdit')); ->will($this->returnValue('UserToEdit'));
$targetUser = $this->getMock('\OCP\IUser'); $targetUser = $this->getMock('\OCP\IUser');
$targetUser->expects($this->once())
->method('setQuota')
->with('2.9 MB');
$this->userSession $this->userSession
->expects($this->once()) ->expects($this->once())
->method('getUser') ->method('getUser')
@ -1029,10 +1032,6 @@ class UsersTest extends OriginalTest {
->method('isAdmin') ->method('isAdmin')
->with('UserToEdit') ->with('UserToEdit')
->will($this->returnValue(true)); ->will($this->returnValue(true));
$this->config
->expects($this->once())
->method('setUserValue')
->with('UserToEdit', 'files', 'quota', '2.9 MB');
$expected = new \OC_OCS_Result(null, 100); $expected = new \OC_OCS_Result(null, 100);
$this->assertEquals($expected, $this->api->editUser(['userid' => 'UserToEdit', '_put' => ['key' => 'quota', 'value' => '3042824']])); $this->assertEquals($expected, $this->api->editUser(['userid' => 'UserToEdit', '_put' => ['key' => 'quota', 'value' => '3042824']]));
@ -1071,6 +1070,9 @@ class UsersTest extends OriginalTest {
->method('getUID') ->method('getUID')
->will($this->returnValue('admin')); ->will($this->returnValue('admin'));
$targetUser = $this->getMock('\OCP\IUser'); $targetUser = $this->getMock('\OCP\IUser');
$targetUser->expects($this->once())
->method('setQuota')
->with('2.9 MB');
$this->userSession $this->userSession
->expects($this->once()) ->expects($this->once())
->method('getUser') ->method('getUser')
@ -1092,10 +1094,6 @@ class UsersTest extends OriginalTest {
->expects($this->once()) ->expects($this->once())
->method('getSubAdmin') ->method('getSubAdmin')
->will($this->returnValue($subAdminManager)); ->will($this->returnValue($subAdminManager));
$this->config
->expects($this->once())
->method('setUserValue')
->with('UserToEdit', 'files', 'quota', '2.9 MB');
$expected = new \OC_OCS_Result(null, 100); $expected = new \OC_OCS_Result(null, 100);
$this->assertEquals($expected, $this->api->editUser(['userid' => 'UserToEdit', '_put' => ['key' => 'quota', 'value' => '3042824']])); $this->assertEquals($expected, $this->api->editUser(['userid' => 'UserToEdit', '_put' => ['key' => 'quota', 'value' => '3042824']]));
@ -1108,6 +1106,9 @@ class UsersTest extends OriginalTest {
->method('getUID') ->method('getUID')
->will($this->returnValue('subadmin')); ->will($this->returnValue('subadmin'));
$targetUser = $this->getMock('\OCP\IUser'); $targetUser = $this->getMock('\OCP\IUser');
$targetUser->expects($this->once())
->method('setQuota')
->with('2.9 MB');
$this->userSession $this->userSession
->expects($this->once()) ->expects($this->once())
->method('getUser') ->method('getUser')
@ -1129,10 +1130,6 @@ class UsersTest extends OriginalTest {
->expects($this->once()) ->expects($this->once())
->method('getSubAdmin') ->method('getSubAdmin')
->will($this->returnValue($subAdminManager)); ->will($this->returnValue($subAdminManager));
$this->config
->expects($this->once())
->method('setUserValue')
->with('UserToEdit', 'files', 'quota', '2.9 MB');
$expected = new \OC_OCS_Result(null, 100); $expected = new \OC_OCS_Result(null, 100);
$this->assertEquals($expected, $this->api->editUser(['userid' => 'UserToEdit', '_put' => ['key' => 'quota', 'value' => '3042824']])); $this->assertEquals($expected, $this->api->editUser(['userid' => 'UserToEdit', '_put' => ['key' => 'quota', 'value' => '3042824']]));

View File

@ -210,13 +210,15 @@ class Test_User_User extends \Test\TestCase {
$this->equalTo('myquota')) $this->equalTo('myquota'))
->will($this->returnValue(array('42 GB'))); ->will($this->returnValue(array('42 GB')));
$config->expects($this->once()) $user = $this->getMock('\OCP\IUser');
->method('setUserValue') $user->expects($this->once())
->with($this->equalTo('alice'), ->method('setQuota')
$this->equalTo('files'), ->with('42 GB');
$this->equalTo('quota'),
$this->equalTo('42 GB')) $userMgr->expects($this->once())
->will($this->returnValue(true)); ->method('get')
->with('alice')
->will($this->returnValue($user));
$uid = 'alice'; $uid = 'alice';
$dn = 'uid=alice,dc=foo,dc=bar'; $dn = 'uid=alice,dc=foo,dc=bar';
@ -253,13 +255,15 @@ class Test_User_User extends \Test\TestCase {
$this->equalTo('myquota')) $this->equalTo('myquota'))
->will($this->returnValue(false)); ->will($this->returnValue(false));
$config->expects($this->once()) $user = $this->getMock('\OCP\IUser');
->method('setUserValue') $user->expects($this->once())
->with($this->equalTo('alice'), ->method('setQuota')
$this->equalTo('files'), ->with('25 GB');
$this->equalTo('quota'),
$this->equalTo('25 GB')) $userMgr->expects($this->once())
->will($this->returnValue(true)); ->method('get')
->with('alice')
->will($this->returnValue($user));
$uid = 'alice'; $uid = 'alice';
$dn = 'uid=alice,dc=foo,dc=bar'; $dn = 'uid=alice,dc=foo,dc=bar';
@ -296,13 +300,15 @@ class Test_User_User extends \Test\TestCase {
$this->equalTo('myquota')) $this->equalTo('myquota'))
->will($this->returnValue(array('27 GB'))); ->will($this->returnValue(array('27 GB')));
$config->expects($this->once()) $user = $this->getMock('\OCP\IUser');
->method('setUserValue') $user->expects($this->once())
->with($this->equalTo('alice'), ->method('setQuota')
$this->equalTo('files'), ->with('27 GB');
$this->equalTo('quota'),
$this->equalTo('27 GB')) $userMgr->expects($this->once())
->will($this->returnValue(true)); ->method('get')
->with('alice')
->will($this->returnValue($user));
$uid = 'alice'; $uid = 'alice';
$dn = 'uid=alice,dc=foo,dc=bar'; $dn = 'uid=alice,dc=foo,dc=bar';
@ -408,13 +414,15 @@ class Test_User_User extends \Test\TestCase {
$access->expects($this->never()) $access->expects($this->never())
->method('readAttribute'); ->method('readAttribute');
$config->expects($this->once()) $user = $this->getMock('\OCP\IUser');
->method('setUserValue') $user->expects($this->once())
->with($this->equalTo('alice'), ->method('setQuota')
$this->equalTo('files'), ->with($readQuota);
$this->equalTo('quota'),
$this->equalTo($readQuota)) $userMgr->expects($this->once())
->will($this->returnValue(true)); ->method('get')
->with('alice')
->will($this->returnValue($user));
$uid = 'alice'; $uid = 'alice';
$dn = 'uid=alice,dc=foo,dc=bar'; $dn = 'uid=alice,dc=foo,dc=bar';