aboutsummaryrefslogtreecommitdiffstats
path: root/apps/provisioning_api/tests
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-03-17 14:47:47 +0100
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-03-23 12:06:50 +0100
commit5f38cfbc8072936c71d3e15d98a6df75079d046c (patch)
treee5a2b71a1390ff2343571590e641fbeeb25b227c /apps/provisioning_api/tests
parent3cac7911d592260fd48a489ee07bf4cb3b500dd9 (diff)
downloadnextcloud-server-5f38cfbc8072936c71d3e15d98a6df75079d046c.tar.gz
nextcloud-server-5f38cfbc8072936c71d3e15d98a6df75079d046c.zip
Return groups displayname in provisioning api
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/provisioning_api/tests')
-rw-r--r--apps/provisioning_api/tests/Controller/GroupsControllerTest.php31
1 files changed, 31 insertions, 0 deletions
diff --git a/apps/provisioning_api/tests/Controller/GroupsControllerTest.php b/apps/provisioning_api/tests/Controller/GroupsControllerTest.php
index cd3dae79336..352264c7afb 100644
--- a/apps/provisioning_api/tests/Controller/GroupsControllerTest.php
+++ b/apps/provisioning_api/tests/Controller/GroupsControllerTest.php
@@ -85,6 +85,10 @@ class GroupsControllerTest extends \Test\TestCase {
$group
->method('getGID')
->willReturn($gid);
+ $group
+ ->method('getDisplayName')
+ ->willReturn($gid.'-name');
+
return $group;
}
@@ -165,6 +169,33 @@ class GroupsControllerTest extends \Test\TestCase {
$result = $this->api->getGroups($search, $limit, $offset);
$this->assertEquals(['groups' => ['group1', 'group2']], $result->getData());
+
+ }
+
+ /**
+ * @dataProvider dataGetGroups
+ *
+ * @param string|null $search
+ * @param int|null $limit
+ * @param int|null $offset
+ */
+ public function testGetGroupsDetails($search, $limit, $offset) {
+ $groups = [$this->createGroup('group1'), $this->createGroup('group2')];
+
+ $search = $search === null ? '' : $search;
+
+ $this->groupManager
+ ->expects($this->once())
+ ->method('search')
+ ->with($search, $limit, $offset)
+ ->willReturn($groups);
+
+ $result = $this->api->getGroupsDetails($search, $limit, $offset);
+ $this->assertEquals(['groups' => [
+ Array('id' => 'group1', 'displayname' => 'group1-name'),
+ Array('id' => 'group2', 'displayname' => 'group2-name')
+ ]], $result->getData());
+
}
public function testGetGroupAsSubadmin() {