diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2015-09-15 16:52:12 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-09-15 16:52:12 +0200 |
commit | a446b43bccc2f366a3e64df25320d8e05cd68acb (patch) | |
tree | d735ef8ca6bb686fd4a83cb1ece89a31d6fcd6ec /tests/core | |
parent | 650e600b942d830460bb96de6726bdd1e8284a8e (diff) | |
download | nextcloud-server-a446b43bccc2f366a3e64df25320d8e05cd68acb.tar.gz nextcloud-server-a446b43bccc2f366a3e64df25320d8e05cd68acb.zip |
Revert "Allow Remote avatars"
Diffstat (limited to 'tests/core')
-rw-r--r-- | tests/core/avatar/avatarcontrollertest.php | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/tests/core/avatar/avatarcontrollertest.php b/tests/core/avatar/avatarcontrollertest.php index 9accd5181c6..e8fb977fae1 100644 --- a/tests/core/avatar/avatarcontrollertest.php +++ b/tests/core/avatar/avatarcontrollertest.php @@ -96,12 +96,8 @@ class AvatarControllerTest extends \Test\TestCase { // Configure userMock $this->userMock->method('getDisplayName')->willReturn($this->user); $this->userMock->method('getUID')->willReturn($this->user); - $this->container['UserManager'] - ->method('get') + $this->container['UserManager']->method('get') ->willReturnMap([[$this->user, $this->userMock]]); - $this->container['UserManager'] - ->method('userExists') - ->willReturnMap([[$this->user, true]]); $this->container['UserSession']->method('getUser')->willReturn($this->userMock); } @@ -124,10 +120,11 @@ class AvatarControllerTest extends \Test\TestCase { * Fetch an avatar if a user has no avatar */ public function testGetAvatarNoAvatar() { - $this->container['UserManager']->expects($this->once())->method('userExists'); - $this->container['AvatarManager']->expects($this->once())->method('getAvatar')->willReturn($this->avatarMock); + $this->container['AvatarManager']->method('getAvatar')->willReturn($this->avatarMock); $response = $this->avatarController->getAvatar($this->user, 32); + //Comment out until JS is fixed + //$this->assertEquals(Http::STATUS_NOT_FOUND, $response->getStatus()); $this->assertEquals(Http::STATUS_OK, $response->getStatus()); $this->assertEquals($this->user, $response->getData()['data']['displayname']); } @@ -136,11 +133,9 @@ class AvatarControllerTest extends \Test\TestCase { * Fetch the user's avatar */ public function testGetAvatar() { - $this->container['UserManager']->expects($this->once())->method('userExists'); - $image = new Image(OC::$SERVERROOT.'/tests/data/testimage.jpg'); - $this->avatarMock->expects($this->once())->method('get')->willReturn($image); - $this->container['AvatarManager']->expects($this->once())->method('getAvatar')->willReturn($this->avatarMock); + $this->avatarMock->method('get')->willReturn($image); + $this->container['AvatarManager']->method('getAvatar')->willReturn($this->avatarMock); $response = $this->avatarController->getAvatar($this->user, 32); @@ -155,19 +150,21 @@ class AvatarControllerTest extends \Test\TestCase { * Fetch the avatar of a non-existing user */ public function testGetAvatarNoUser() { - $this->container['UserManager']->expects($this->once())->method('userExists'); + $this->avatarMock->method('get')->willReturn(null); + $this->container['AvatarManager']->method('getAvatar')->willReturn($this->avatarMock); + $response = $this->avatarController->getAvatar($this->user . 'doesnotexist', 32); //Comment out until JS is fixed - $this->assertEquals(Http::STATUS_NOT_FOUND, $response->getStatus()); - $this->assertEquals([], $response->getData()); + //$this->assertEquals(Http::STATUS_NOT_FOUND, $response->getStatus()); + $this->assertEquals(Http::STATUS_OK, $response->getStatus()); + $this->assertEquals('', $response->getData()['data']['displayname']); } /** * Make sure we get the correct size */ public function testGetAvatarSize() { - $this->container['UserManager']->expects($this->once())->method('userExists'); $this->avatarMock->expects($this->once()) ->method('get') ->with($this->equalTo(32)); @@ -181,7 +178,6 @@ class AvatarControllerTest extends \Test\TestCase { * We cannot get avatars that are 0 or negative */ public function testGetAvatarSizeMin() { - $this->container['UserManager']->expects($this->once())->method('userExists'); $this->avatarMock->expects($this->once()) ->method('get') ->with($this->equalTo(64)); @@ -195,7 +191,6 @@ class AvatarControllerTest extends \Test\TestCase { * We do not support avatars larger than 2048*2048 */ public function testGetAvatarSizeMax() { - $this->container['UserManager']->expects($this->once())->method('userExists'); $this->avatarMock->expects($this->once()) ->method('get') ->with($this->equalTo(2048)); |