diff options
author | Bjoern Schiessle <bjoern@schiessle.org> | 2017-02-09 16:12:57 +0100 |
---|---|---|
committer | Bjoern Schiessle <bjoern@schiessle.org> | 2017-02-09 16:23:10 +0100 |
commit | 2ca8339d012773e3906244f7b039e5bd72920c5f (patch) | |
tree | ff2bc312aa408a82855778a7032d2717c0ce8cb2 /apps/provisioning_api/tests | |
parent | bf88060a98ce397768d4afa7935b80751e4533f8 (diff) | |
download | nextcloud-server-2ca8339d012773e3906244f7b039e5bd72920c5f.tar.gz nextcloud-server-2ca8339d012773e3906244f7b039e5bd72920c5f.zip |
add groups to user info output
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
Diffstat (limited to 'apps/provisioning_api/tests')
-rw-r--r-- | apps/provisioning_api/tests/Controller/UsersControllerTest.php | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/apps/provisioning_api/tests/Controller/UsersControllerTest.php b/apps/provisioning_api/tests/Controller/UsersControllerTest.php index a3e5bf6fde6..a049b15bf03 100644 --- a/apps/provisioning_api/tests/Controller/UsersControllerTest.php +++ b/apps/provisioning_api/tests/Controller/UsersControllerTest.php @@ -635,6 +635,9 @@ class UsersControllerTest extends OriginalTest { } public function testGetUserDataAsAdmin() { + $group = $this->getMockBuilder(IGroup::class) + ->disableOriginalConstructor() + ->getMock(); $loggedInUser = $this->getMockBuilder('OCP\IUser') ->disableOriginalConstructor() ->getMock(); @@ -662,6 +665,19 @@ class UsersControllerTest extends OriginalTest { ->method('isAdmin') ->with('admin') ->will($this->returnValue(true)); + $this->groupManager + ->expects($this->any()) + ->method('getUserGroups') + ->willReturn([$group, $group, $group]); + $group->expects($this->at(0)) + ->method('getDisplayName') + ->willReturn('group0'); + $group->expects($this->at(1)) + ->method('getDisplayName') + ->willReturn('group1'); + $group->expects($this->at(2)) + ->method('getDisplayName') + ->willReturn('group2'); $this->accountManager->expects($this->any())->method('getUser') ->with($targetUser) ->willReturn( @@ -700,7 +716,8 @@ class UsersControllerTest extends OriginalTest { 'phone' => 'phone', 'address' => 'address', 'webpage' => 'website', - 'twitter' => 'twitter' + 'twitter' => 'twitter', + 'groups' => ['group0', 'group1', 'group2'] ]; $this->assertEquals($expected, $this->invokePrivate($this->api, 'getUserData', ['UserToGet'])); } @@ -734,6 +751,10 @@ class UsersControllerTest extends OriginalTest { ->method('isAdmin') ->with('subadmin') ->will($this->returnValue(false)); + $this->groupManager + ->expects($this->any()) + ->method('getUserGroups') + ->willReturn([]); $subAdminManager = $this->getMockBuilder('OC\SubAdmin') ->disableOriginalConstructor() ->getMock(); @@ -784,7 +805,8 @@ class UsersControllerTest extends OriginalTest { 'phone' => 'phone', 'address' => 'address', 'webpage' => 'website', - 'twitter' => 'twitter' + 'twitter' => 'twitter', + 'groups' => [] ]; $this->assertEquals($expected, $this->invokePrivate($this->api, 'getUserData', ['UserToGet'])); } @@ -872,6 +894,10 @@ class UsersControllerTest extends OriginalTest { ->expects($this->once()) ->method('getSubAdmin') ->will($this->returnValue($subAdminManager)); + $this->groupManager + ->expects($this->any()) + ->method('getUserGroups') + ->willReturn([]); $this->api ->expects($this->once()) ->method('fillStorageInfo') @@ -908,7 +934,8 @@ class UsersControllerTest extends OriginalTest { 'phone' => 'phone', 'address' => 'address', 'webpage' => 'website', - 'twitter' => 'twitter' + 'twitter' => 'twitter', + 'groups' => [] ]; $this->assertEquals($expected, $this->invokePrivate($this->api, 'getUserData', ['subadmin'])); } |