From 07fd3889b1e7752131dc0bc746abec7646c89d01 Mon Sep 17 00:00:00 2001
From: Roeland Jago Douma <rullzer@owncloud.com>
Date: Mon, 11 Jan 2016 20:29:48 +0100
Subject: [PATCH] Fix unit tests

---
 apps/federation/tests/api/ocsauthapitest.php           |  2 --
 apps/federation/tests/lib/trustedserverstest.php       |  2 --
 .../lostpassword/controller/lostcontrollertest.php     | 10 ----------
 tests/lib/appframework/http/RequestTest.php            |  9 +--------
 4 files changed, 1 insertion(+), 22 deletions(-)

diff --git a/apps/federation/tests/api/ocsauthapitest.php b/apps/federation/tests/api/ocsauthapitest.php
index e6a95af8585..0a708a0a9f2 100644
--- a/apps/federation/tests/api/ocsauthapitest.php
+++ b/apps/federation/tests/api/ocsauthapitest.php
@@ -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())
diff --git a/apps/federation/tests/lib/trustedserverstest.php b/apps/federation/tests/lib/trustedserverstest.php
index d067cd1c185..c1b3f83d69f 100644
--- a/apps/federation/tests/lib/trustedserverstest.php
+++ b/apps/federation/tests/lib/trustedserverstest.php
@@ -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');
diff --git a/tests/core/lostpassword/controller/lostcontrollertest.php b/tests/core/lostpassword/controller/lostcontrollertest.php
index eb0447f278b..0843d82da3f 100644
--- a/tests/core/lostpassword/controller/lostcontrollertest.php
+++ b/tests/core/lostpassword/controller/lostcontrollertest.php
@@ -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')
diff --git a/tests/lib/appframework/http/RequestTest.php b/tests/lib/appframework/http/RequestTest.php
index 32603d0da59..ab79eb498fa 100644
--- a/tests/lib/appframework/http/RequestTest.php
+++ b/tests/lib/appframework/http/RequestTest.php
@@ -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,
-- 
GitLab