summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2016-02-02 12:37:31 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2016-02-02 12:37:31 +0100
commiteee6f3d4062d8132938e083881a84660887c17af (patch)
tree819ef10546388cfa14910b55b27df60e325306a0 /tests
parentc9006d6d560b5b9c0f7df103d68b7b3184fcf439 (diff)
parent619a4d2e523052f0b2b55f1819aff6bc9883537a (diff)
downloadnextcloud-server-eee6f3d4062d8132938e083881a84660887c17af.tar.gz
nextcloud-server-eee6f3d4062d8132938e083881a84660887c17af.zip
Merge pull request #22057 from owncloud/share2_update_hash
Update old password hashed for link shares on access
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/share20/managertest.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/lib/share20/managertest.php b/tests/lib/share20/managertest.php
index b5559bb5172..cdcb71ed1e5 100644
--- a/tests/lib/share20/managertest.php
+++ b/tests/lib/share20/managertest.php
@@ -1645,6 +1645,27 @@ class ManagerTest extends \Test\TestCase {
$this->assertTrue($this->manager->checkPassword($share, 'password'));
}
+ public function testCheckPasswordUpdateShare() {
+ $share = $this->manager->newShare();
+ $share->setShareType(\OCP\Share::SHARE_TYPE_LINK)
+ ->setPassword('passwordHash');
+
+ $this->hasher->method('verify')->with('password', 'passwordHash', '')
+ ->will($this->returnCallback(function($pass, $hash, &$newHash) {
+ $newHash = 'newHash';
+
+ return true;
+ }));
+
+ $this->defaultProvider->expects($this->once())
+ ->method('update')
+ ->with($this->callback(function (\OCP\Share\IShare $share) {
+ return $share->getPassword() === 'newHash';
+ }));
+
+ $this->assertTrue($this->manager->checkPassword($share, 'password'));
+ }
+
/**
* @expectedException Exception
* @expectedExceptionMessage The Share API is disabled