Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2016-08-30 09:32:55 +0300
committerGitHub <noreply@github.com>2016-08-30 09:32:55 +0300
commite341bde8b9e97326f50b5c28135b4163343398c8 (patch)
treeaa0f3ed4329ef03e96c642b3f57ecb7de2db07bd /tests/Core
parent4afe4bda2686ebb770b7574e87573a2cf708cd4c (diff)
parentb1a090f3576895f526cd102c43aad56789e6e889 (diff)
Merge pull request #1172 from nextcloud/core_cleanup
Core controller cleanup
Diffstat (limited to 'tests/Core')
-rw-r--r--tests/Core/Controller/AvatarControllerTest.php6
-rw-r--r--tests/Core/Controller/TokenControllerTest.php16
2 files changed, 12 insertions, 10 deletions
diff --git a/tests/Core/Controller/AvatarControllerTest.php b/tests/Core/Controller/AvatarControllerTest.php
index a275a8bd16a..fe1a44b28ab 100644
--- a/tests/Core/Controller/AvatarControllerTest.php
+++ b/tests/Core/Controller/AvatarControllerTest.php
@@ -228,7 +228,7 @@ class AvatarControllerTest extends \Test\TestCase {
$this->logger->expects($this->once())
->method('logException')
->with(new \Exception("foo"));
- $expectedResponse = new Http\DataResponse(['data' => ['message' => 'An error occurred. Please contact your admin.']], Http::STATUS_BAD_REQUEST);
+ $expectedResponse = new Http\JSONResponse(['data' => ['message' => 'An error occurred. Please contact your admin.']], Http::STATUS_BAD_REQUEST);
$this->assertEquals($expectedResponse, $this->avatarController->deleteAvatar());
}
@@ -377,7 +377,7 @@ class AvatarControllerTest extends \Test\TestCase {
$this->logger->expects($this->once())
->method('logException')
->with(new \Exception("foo"));
- $expectedResponse = new Http\DataResponse(['data' => ['message' => 'An error occurred. Please contact your admin.']], Http::STATUS_OK);
+ $expectedResponse = new Http\JSONResponse(['data' => ['message' => 'An error occurred. Please contact your admin.']], Http::STATUS_OK);
$this->assertEquals($expectedResponse, $this->avatarController->postAvatar('avatar.jpg'));
}
@@ -437,7 +437,7 @@ class AvatarControllerTest extends \Test\TestCase {
$this->logger->expects($this->once())
->method('logException')
->with(new \Exception('foo'));
- $expectedResponse = new Http\DataResponse(['data' => ['message' => 'An error occurred. Please contact your admin.']], Http::STATUS_BAD_REQUEST);
+ $expectedResponse = new Http\JSONResponse(['data' => ['message' => 'An error occurred. Please contact your admin.']], Http::STATUS_BAD_REQUEST);
$this->assertEquals($expectedResponse, $this->avatarController->postCroppedAvatar(['x' => 0, 'y' => 0, 'w' => 10, 'h' => 11]));
}
diff --git a/tests/Core/Controller/TokenControllerTest.php b/tests/Core/Controller/TokenControllerTest.php
index b6b54b14fad..0e965aac2e5 100644
--- a/tests/Core/Controller/TokenControllerTest.php
+++ b/tests/Core/Controller/TokenControllerTest.php
@@ -41,15 +41,17 @@ class TokenControllerTest extends TestCase {
protected function setUp() {
parent::setUp();
- $this->request = $this->getMock('\OCP\IRequest');
+ $this->request = $this->getMockBuilder('\OCP\IRequest')->getMock();
$this->userManager = $this->getMockBuilder('\OC\User\Manager')
->disableOriginalConstructor()
->getMock();
- $this->tokenProvider = $this->getMock('\OC\Authentication\Token\IProvider');
+ $this->tokenProvider = $this->getMockBuilder('\OC\Authentication\Token\IProvider')
+ ->getMock();
$this->twoFactorAuthManager = $this->getMockBuilder('\OC\Authentication\TwoFactorAuth\Manager')
->disableOriginalConstructor()
->getMock();
- $this->secureRandom = $this->getMock('\OCP\Security\ISecureRandom');
+ $this->secureRandom = $this->getMockBuilder('\OCP\Security\ISecureRandom')
+ ->getMock();
$this->tokenController = new TokenController('core', $this->request, $this->userManager, $this->tokenProvider, $this->twoFactorAuthManager, $this->secureRandom);
}
@@ -77,7 +79,7 @@ class TokenControllerTest extends TestCase {
}
public function testWithValidCredentials() {
- $user = $this->getMock('\OCP\IUser');
+ $user = $this->getMockBuilder('\OCP\IUser')->getMock();
$this->userManager->expects($this->once())
->method('checkPassword')
->with('john', '123456')
@@ -96,9 +98,9 @@ class TokenControllerTest extends TestCase {
$this->tokenProvider->expects($this->once())
->method('generateToken')
->with('verysecurerandomtoken', 'john', 'john', '123456', 'unknown client', IToken::PERMANENT_TOKEN);
- $expected = [
+ $expected = new JSONResponse([
'token' => 'verysecurerandomtoken'
- ];
+ ]);
$actual = $this->tokenController->generateToken('john', '123456');
@@ -106,7 +108,7 @@ class TokenControllerTest extends TestCase {
}
public function testWithValidCredentialsBut2faEnabled() {
- $user = $this->getMock('\OCP\IUser');
+ $user = $this->getMockBuilder('\OCP\IUser')->getMock();
$this->userManager->expects($this->once())
->method('checkPassword')
->with('john', '123456')