diff options
author | Daniel Kesselberg <mail@danielkesselberg.de> | 2019-02-17 22:45:05 +0100 |
---|---|---|
committer | Daniel Kesselberg <mail@danielkesselberg.de> | 2019-02-17 23:37:22 +0100 |
commit | 2ade2bef8c7c030258943b680401aec64bcdb9a2 (patch) | |
tree | e57a96b23afabe32fa9d9423d7ec6d6da524360a /tests/Core | |
parent | cb3379e97d965cf95543bf66160d6636e5c50c11 (diff) | |
download | nextcloud-server-2ade2bef8c7c030258943b680401aec64bcdb9a2.tar.gz nextcloud-server-2ade2bef8c7c030258943b680401aec64bcdb9a2.zip |
Publish activity for app token created by ocs api
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
Diffstat (limited to 'tests/Core')
-rw-r--r-- | tests/Core/Controller/AppPasswordControllerTest.php | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/tests/Core/Controller/AppPasswordControllerTest.php b/tests/Core/Controller/AppPasswordControllerTest.php index f0c223ccc1d..ace6170f984 100644 --- a/tests/Core/Controller/AppPasswordControllerTest.php +++ b/tests/Core/Controller/AppPasswordControllerTest.php @@ -27,11 +27,14 @@ namespace Tests\Core\Controller; use OC\Authentication\Token\IProvider; use OC\Authentication\Token\IToken; use OC\Core\Controller\AppPasswordController; +use OCP\Activity\IEvent; +use OCP\Activity\IManager as IActivityManager; use OCP\AppFramework\OCS\OCSForbiddenException; use OCP\Authentication\Exceptions\CredentialsUnavailableException; use OCP\Authentication\Exceptions\PasswordUnavailableException; use OCP\Authentication\LoginCredentials\ICredentials; use OCP\Authentication\LoginCredentials\IStore; +use OCP\ILogger; use OCP\IRequest; use OCP\ISession; use OCP\Security\ISecureRandom; @@ -55,6 +58,9 @@ class AppPasswordControllerTest extends TestCase { /** @var IRequest|MockObject */ private $request; + /** @var IActivityManager|\PHPUnit_Framework_MockObject_MockObject */ + private $activityManager; + /** @var AppPasswordController */ private $controller; @@ -66,6 +72,9 @@ class AppPasswordControllerTest extends TestCase { $this->tokenProvider = $this->createMock(IProvider::class); $this->credentialStore = $this->createMock(IStore::class); $this->request = $this->createMock(IRequest::class); + $this->activityManager = $this->createMock(IActivityManager::class); + /** @var ILogger|\PHPUnit_Framework_MockObject_MockObject $logger */ + $logger = $this->createMock(ILogger::class); $this->controller = new AppPasswordController( 'core', @@ -73,7 +82,9 @@ class AppPasswordControllerTest extends TestCase { $this->session, $this->random, $this->tokenProvider, - $this->credentialStore + $this->credentialStore, + $this->activityManager, + $logger ); } @@ -134,6 +145,12 @@ class AppPasswordControllerTest extends TestCase { IToken::DO_NOT_REMEMBER ); + $this->activityManager->expects($this->once()) + ->method('generateEvent') + ->willReturn($this->createMock(IEvent::class)); + $this->activityManager->expects($this->once()) + ->method('publish'); + $this->controller->getAppPassword(); } @@ -172,6 +189,12 @@ class AppPasswordControllerTest extends TestCase { IToken::DO_NOT_REMEMBER ); + $this->activityManager->expects($this->once()) + ->method('generateEvent') + ->willReturn($this->createMock(IEvent::class)); + $this->activityManager->expects($this->once()) + ->method('publish'); + $this->controller->getAppPassword(); } |