Fixed tests

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
John Molakvoæ (skjnldsv) 2018-02-28 17:35:42 +01:00
parent a0641e43dc
commit 8c69d783e0
No known key found for this signature in database
GPG Key ID: FB5ACEED51955BF8
2 changed files with 6 additions and 6 deletions

View File

@ -174,7 +174,7 @@ class ShareController extends Controller {
* @param string $password
* @return RedirectResponse|TemplateResponse|NotFoundResponse
*/
public function authenticate($token, $redirect, $password = '') {
public function authenticate($token, $redirect = 'preview', $password = '') {
// Check whether share exists
try {

View File

@ -249,7 +249,7 @@ class ShareControllerTest extends \Test\TestCase {
->with('files_sharing.sharecontroller.showShare', ['token'=>'token'])
->willReturn('redirect');
$response = $this->shareController->authenticate('token', 'validpassword');
$response = $this->shareController->authenticate('token', 'preview', 'validpassword');
$expectedResponse = new RedirectResponse('redirect');
$this->assertEquals($expectedResponse, $response);
}
@ -292,7 +292,7 @@ class ShareControllerTest extends \Test\TestCase {
$data['errorMessage'] === 'Wrong password';
}));
$response = $this->shareController->authenticate('token', 'invalidpassword');
$response = $this->shareController->authenticate('token', 'preview', 'invalidpassword');
$expectedResponse = new TemplateResponse($this->appName, 'authenticate', array('wrongpw' => true), 'guest');
$expectedResponse->throttle();
$this->assertEquals($expectedResponse, $response);
@ -323,7 +323,7 @@ class ShareControllerTest extends \Test\TestCase {
$this->urlGenerator->expects($this->once())
->method('linkToRoute')
->with('files_sharing.sharecontroller.authenticate', ['token' => 'validtoken'])
->with('files_sharing.sharecontroller.authenticate', ['token' => 'validtoken', 'redirect' => 'preview'])
->willReturn('redirect');
// Test without a not existing token
@ -505,12 +505,12 @@ class ShareControllerTest extends \Test\TestCase {
$this->urlGenerator->expects($this->once())
->method('linkToRoute')
->with('files_sharing.sharecontroller.authenticate', ['token' => 'validtoken'])
->with('files_sharing.sharecontroller.authenticate', ['token' => 'validtoken', 'redirect' => 'download'])
->willReturn('redirect');
// Test with a password protected share and no authentication
$response = $this->shareController->downloadShare('validtoken');
$expectedResponse = new RedirectResponse('redirect');
$expectedResponse = new RedirectResponse('redirect', '');
$this->assertEquals($expectedResponse, $response);
}