Skip to content

Commit

Permalink
fixing test
Browse files Browse the repository at this point in the history
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
  • Loading branch information
ArtificialOwl committed Aug 16, 2023
1 parent 79917d9 commit 680b42e
Showing 1 changed file with 2 additions and 22 deletions.
24 changes: 2 additions & 22 deletions apps/files_external/tests/Controller/AjaxControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,17 +102,12 @@ public function testSaveGlobalCredentialsAsAdminForAnotherUser() {
->expects($this->once())
->method('getUser')
->willReturn($user);
$this->groupManager
->expects($this->once())
->method('isAdmin')
->with('MyAdminUid')
->willReturn(true);
$this->globalAuth
->expects($this->once())
->method('saveAuth')
->with('UidOfTestUser', 'test', 'password');

$this->assertSame(true, $this->ajaxController->saveGlobalCredentials('UidOfTestUser', 'test', 'password'));
$this->assertSame(false, $this->ajaxController->saveGlobalCredentials('UidOfTestUser', 'test', 'password'));
}

public function testSaveGlobalCredentialsAsAdminForSelf() {
Expand All @@ -125,17 +120,12 @@ public function testSaveGlobalCredentialsAsAdminForSelf() {
->expects($this->once())
->method('getUser')
->willReturn($user);
$this->groupManager
->expects($this->once())
->method('isAdmin')
->with('MyAdminUid')
->willReturn(true);
$this->globalAuth
->expects($this->once())
->method('saveAuth')
->with('MyAdminUid', 'test', 'password');

$this->assertSame(false, $this->ajaxController->saveGlobalCredentials('MyAdminUid', 'test', 'password'));
$this->assertSame(true, $this->ajaxController->saveGlobalCredentials('MyAdminUid', 'test', 'password'));
}

public function testSaveGlobalCredentialsAsNormalUserForSelf() {
Expand All @@ -148,11 +138,6 @@ public function testSaveGlobalCredentialsAsNormalUserForSelf() {
->expects($this->once())
->method('getUser')
->willReturn($user);
$this->groupManager
->expects($this->once())
->method('isAdmin')
->with('MyUserUid')
->willReturn(false);
$this->globalAuth
->expects($this->once())
->method('saveAuth')
Expand All @@ -171,11 +156,6 @@ public function testSaveGlobalCredentialsAsNormalUserForAnotherUser() {
->expects($this->once())
->method('getUser')
->willReturn($user);
$this->groupManager
->expects($this->once())
->method('isAdmin')
->with('MyUserUid')
->willReturn(false);

$this->assertSame(false, $this->ajaxController->saveGlobalCredentials('AnotherUserUid', 'test', 'password'));
}
Expand Down

0 comments on commit 680b42e

Please sign in to comment.