Ejemplo n.º 1
0
 public function testDeleteGroup()
 {
     $group = $this->groupManager->createGroup($this->getUniqueId());
     $result = $this->api->deleteGroup(['groupid' => $group->getGID()]);
     $this->assertInstanceOf('OC_OCS_Result', $result);
     $this->assertTrue($result->succeeded());
     $this->assertFalse($this->groupManager->groupExists($group->getGID()));
 }
Ejemplo n.º 2
0
 public function testDeleteGroup()
 {
     $this->groupManager->method('groupExists')->with('ExistingGroup')->willReturn('true');
     $group = $this->createGroup('ExistingGroup');
     $this->groupManager->method('get')->with('ExistingGroup')->willReturn($group);
     $group->expects($this->once())->method('delete')->willReturn(true);
     $result = $this->api->deleteGroup(['groupid' => 'ExistingGroup']);
     $this->assertInstanceOf('OC_OCS_Result', $result);
     $this->assertTrue($result->succeeded());
 }
Ejemplo n.º 3
0
 public function testGetSubAdminsOfGroup()
 {
     $user1 = $this->generateUsers();
     $user2 = $this->generateUsers();
     self::loginAsUser($user1);
     \OC_Group::addToGroup($user1, 'admin');
     $group1 = $this->getUniqueID();
     \OC_Group::createGroup($group1);
     \OC_SubAdmin::createSubAdmin($user2, $group1);
     $result = \OCA\provisioning_api\Groups::getSubAdminsOfGroup(array('groupid' => $group1));
     $this->assertInstanceOf('OC_OCS_Result', $result);
     $this->assertTrue($result->succeeded());
     $data = $result->getData();
     $this->assertEquals($user2, reset($data));
     \OC_Group::deleteGroup($group1);
     $user1 = $this->generateUsers();
     self::loginAsUser($user1);
     \OC_Group::addToGroup($user1, 'admin');
     $result = \OCA\provisioning_api\Groups::getSubAdminsOfGroup(array('groupid' => $this->getUniqueID()));
     $this->assertInstanceOf('OC_OCS_Result', $result);
     $this->assertFalse($result->succeeded());
     $this->assertEquals(101, $result->getStatusCode());
 }