Fix unit tests

This commit is contained in:
Roeland Jago Douma 2016-01-11 20:29:48 +01:00
parent 876fb83ddc
commit 07fd3889b1
4 changed files with 1 additions and 22 deletions

View file

@ -155,8 +155,6 @@ class OCSAuthAPITest extends TestCase {
->method('isValidToken')->with($url, $token)->willReturn($isValidToken);
if($expected === Http::STATUS_OK) {
$this->secureRandom->expects($this->once())->method('getMediumStrengthGenerator')
->willReturn($this->secureRandom);
$this->secureRandom->expects($this->once())->method('generate')->with(32)
->willReturn('secret');
$this->trustedServers->expects($this->once())

View file

@ -113,8 +113,6 @@ class TrustedServersTest extends TestCase {
->willReturn($success);
if ($success) {
$this->secureRandom->expects($this->once())->method('getMediumStrengthGenerator')
->willReturn($this->secureRandom);
$this->secureRandom->expects($this->once())->method('generate')
->willReturn('token');
$this->dbHandler->expects($this->once())->method('addToken')->with('https://url', 'token');

View file

@ -167,7 +167,6 @@ class LostControllerTest extends \PHPUnit_Framework_TestCase {
}
public function testEmailSuccessful() {
$randomToken = $this->secureRandom;
$this->secureRandom
->expects($this->once())
->method('generate')
@ -187,10 +186,6 @@ class LostControllerTest extends \PHPUnit_Framework_TestCase {
->expects($this->once())
->method('getTime')
->will($this->returnValue(12348));
$this->secureRandom
->expects($this->once())
->method('getMediumStrengthGenerator')
->will($this->returnValue($randomToken));
$this->config
->expects($this->once())
->method('setUserValue')
@ -233,7 +228,6 @@ class LostControllerTest extends \PHPUnit_Framework_TestCase {
}
public function testEmailCantSendException() {
$randomToken = $this->secureRandom;
$this->secureRandom
->expects($this->once())
->method('generate')
@ -249,10 +243,6 @@ class LostControllerTest extends \PHPUnit_Framework_TestCase {
->method('get')
->with('ExistingUser')
->willReturn($this->existingUser);
$this->secureRandom
->expects($this->once())
->method('getMediumStrengthGenerator')
->will($this->returnValue($randomToken));
$this->config
->expects($this->once())
->method('setUserValue')

View file

@ -352,18 +352,11 @@ class RequestTest extends \Test\TestCase {
}
public function testGetIdWithoutModUnique() {
$lowRandomSource = $this->getMockBuilder('\OCP\Security\ISecureRandom')
->disableOriginalConstructor()->getMock();
$lowRandomSource->expects($this->once())
$this->secureRandom->expects($this->once())
->method('generate')
->with('20')
->will($this->returnValue('GeneratedByOwnCloudItself'));
$this->secureRandom
->expects($this->once())
->method('getLowStrengthGenerator')
->will($this->returnValue($lowRandomSource));
$request = new Request(
[],
$this->secureRandom,