diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2018-08-01 22:54:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-01 22:54:38 +0200 |
commit | fae7e516b5e17ae95e850a866c9e5a08732e2f6b (patch) | |
tree | 3234679e25c38ef05f9a88d8368fe03287b4066c /tests | |
parent | b5c5faebfc136d634fd7e80d6a0a8e1094bca717 (diff) | |
parent | 38fffffe18dc705f29bbb477aebd8497f173d37a (diff) | |
download | nextcloud-server-fae7e516b5e17ae95e850a866c9e5a08732e2f6b.tar.gz nextcloud-server-fae7e516b5e17ae95e850a866c9e5a08732e2f6b.zip |
Merge pull request #10481 from nextcloud/feature/noid/make-info-available-if-the-avatar-was-uploaded
Make the info available if the avatar was uploaded or generated
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Core/Controller/AvatarControllerTest.php | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/tests/Core/Controller/AvatarControllerTest.php b/tests/Core/Controller/AvatarControllerTest.php index 3194d671908..3369fa882c8 100644 --- a/tests/Core/Controller/AvatarControllerTest.php +++ b/tests/Core/Controller/AvatarControllerTest.php @@ -34,7 +34,7 @@ namespace Tests\Core\Controller; use OC\AppFramework\Utility\TimeFactory; use OC\Core\Controller\AvatarController; use OCP\AppFramework\Http; -use OCP\Files\Cache\ICache; +use OCP\ICache; use OCP\Files\File; use OCP\Files\IRootFolder; use OCP\Files\NotFoundException; @@ -143,6 +143,9 @@ class AvatarControllerTest extends \Test\TestCase { public function testGetAvatar() { $this->avatarMock->method('getFile')->willReturn($this->avatarFile); $this->avatarManager->method('getAvatar')->with('userId')->willReturn($this->avatarMock); + $this->avatarMock->expects($this->once()) + ->method('isCustomAvatar') + ->willReturn(true); $response = $this->avatarController->getAvatar('userId', 32); @@ -154,6 +157,22 @@ class AvatarControllerTest extends \Test\TestCase { } /** + * Fetch the user's avatar + */ + public function testGetGeneratedAvatar() { + $this->avatarMock->method('getFile')->willReturn($this->avatarFile); + $this->avatarManager->method('getAvatar')->with('userId')->willReturn($this->avatarMock); + + $response = $this->avatarController->getAvatar('userId', 32); + + $this->assertEquals(Http::STATUS_CREATED, $response->getStatus()); + $this->assertArrayHasKey('Content-Type', $response->getHeaders()); + $this->assertEquals('image type', $response->getHeaders()['Content-Type']); + + $this->assertEquals('my etag', $response->getETag()); + } + + /** * Fetch the avatar of a non-existing user */ public function testGetAvatarNoUser() { |