diff options
author | Roeland Jago Douma <rullzer@owncloud.com> | 2016-01-08 10:03:49 +0100 |
---|---|---|
committer | Roeland Jago Douma <rullzer@owncloud.com> | 2016-01-08 10:03:49 +0100 |
commit | 186e35d9548779f71a7523f923474e7a20b52197 (patch) | |
tree | a596b7b5053ed2b66563829fabe9099ccba05242 /tests/core | |
parent | a1a8a06042e1f420fbdc6ff8cc1abead1d60c2ad (diff) | |
download | nextcloud-server-186e35d9548779f71a7523f923474e7a20b52197.tar.gz nextcloud-server-186e35d9548779f71a7523f923474e7a20b52197.zip |
Verify the path is a file on avatar update
Fixes #21533
Before we just assumed that the passed path was a file. This does not
have to be the case. Thus check if it actually is a file before doing
any more tests.
Diffstat (limited to 'tests/core')
-rw-r--r-- | tests/core/avatar/avatarcontrollertest.php | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/core/avatar/avatarcontrollertest.php b/tests/core/avatar/avatarcontrollertest.php index 7f69ba0aadb..9e46e1782af 100644 --- a/tests/core/avatar/avatarcontrollertest.php +++ b/tests/core/avatar/avatarcontrollertest.php @@ -324,6 +324,23 @@ class AvatarControllerTest extends \Test\TestCase { } /** + * Test posting avatar from existing folder + */ + public function testPostAvatarFromNoFile() { + $file = $this->getMock('OCP\Files\Node'); + $this->container['UserFolder'] + ->method('get') + ->with('folder') + ->willReturn($file); + + //Create request return + $response = $this->avatarController->postAvatar('folder'); + + //On correct upload always respond with the notsquare message + $this->assertEquals(['data' => ['message' => 'Please select a file.']], $response->getData()); + } + + /** * Test what happens if the upload of the avatar fails */ public function testPostAvatarException() { |