Fix tests for group restrictions

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2018-12-04 09:25:35 +01:00
parent 7c95783ab5
commit 0528bd59d1
4 changed files with 59 additions and 30 deletions

View File

@@ -150,6 +150,9 @@ class BoardServiceTest extends TestCase {
$this->boardMapper->expects($this->once())
->method('insert')
->willReturn($board);
$this->permissionService->expects($this->once())
->method('canCreate')
->willReturn(true);
$b = $this->service->create('MyBoard', 'admin', '00ff00');
$this->assertEquals($b->getTitle(), 'MyBoard');
@@ -158,6 +161,20 @@ class BoardServiceTest extends TestCase {
$this->assertCount(4, $b->getLabels());
}
/**
* @expectedException \OCA\Deck\NoPermissionException
*/
public function testCreateDenied() {
$board = new Board();
$board->setTitle('MyBoard');
$board->setOwner('admin');
$board->setColor('00ff00');
$this->permissionService->expects($this->once())
->method('canCreate')
->willReturn(false);
$b = $this->service->create('MyBoard', 'admin', '00ff00');
}
public function testUpdate() {
$board = new Board();
$board->setTitle('MyBoard');