Browse Source

Fix unit tests

tags/v9.0beta1
Roeland Jago Douma 8 years ago
parent
commit
07fd3889b1

+ 0
- 2
apps/federation/tests/api/ocsauthapitest.php 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())

+ 0
- 2
apps/federation/tests/lib/trustedserverstest.php 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');

+ 0
- 10
tests/core/lostpassword/controller/lostcontrollertest.php 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')

+ 1
- 8
tests/lib/appframework/http/RequestTest.php 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,

Loading…
Cancel
Save