diff options
author | sualko <klaus@jsxc.org> | 2017-07-28 11:39:48 +0300 |
---|---|---|
committer | sualko <klaus@jsxc.org> | 2017-07-28 11:39:48 +0300 |
commit | bf0a1ef72b8df6ffd36750a49b70f830c1e361fd (patch) | |
tree | 787b9c9fc0c38c99dc527b66910a6d4a285f12c1 /tests/unit | |
parent | da07a823ef6a38b4be3e1972a8fb52bb8d1748f2 (diff) |
add request id to registration request
for easier debugging
Diffstat (limited to 'tests/unit')
-rw-r--r-- | tests/unit/controller/ManagedServerControllerTest.php | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/unit/controller/ManagedServerControllerTest.php b/tests/unit/controller/ManagedServerControllerTest.php index af1d861..0c26693 100644 --- a/tests/unit/controller/ManagedServerControllerTest.php +++ b/tests/unit/controller/ManagedServerControllerTest.php @@ -12,6 +12,7 @@ use OCP\AppFramework\Http\JSONResponse; use OCP\AppFramework\Http; use OCA\OJSXC\Exceptions\Exception; use OCA\OJSXC\IDataRetriever; +use OCP\Security\ISecureRandom; use PHPUnit\Framework\TestCase; class ManagedServerControllerTest extends TestCase @@ -22,6 +23,7 @@ class ManagedServerControllerTest extends TestCase private $userSession; private $logger; private $dataRetriever; + private $random; private $registrationUrl; private $apiUrl; @@ -40,12 +42,17 @@ class ManagedServerControllerTest extends TestCase $this->userSession = $this->createMock(IUserSession::class); $this->logger = $this->createMock(ILogger::class); $this->dataRetriever = $this->createMock(IDataRetriever::class); + $this->random = $this->createMock(ISecureRandom::class); $this->registrationUrl = ''; $this->apiUrl = 'https://localhost/api'; $this->apiSecret = 'dummySecret'; $this->userId = 'dummyUser'; + $this->random + ->expects($this->once()) + ->method('generate') + ->willReturn('dummyRandom'); $this->urlGenerator ->expects($this->once()) ->method('linkToRouteAbsolute') @@ -69,6 +76,7 @@ class ManagedServerControllerTest extends TestCase $this->userSession, $this->logger, $this->dataRetriever, + $this->random, $this->registrationUrl ); } @@ -174,7 +182,7 @@ class ManagedServerControllerTest extends TestCase $this->dataRetriever ->expects($this->once()) ->method('fetchUrl') - ->with($this->registrationUrl, [ + ->with($this->registrationUrl.'?rid=dummyRandom', [ 'apiUrl' => $this->apiUrl, 'apiSecret' => $this->apiSecret, 'apiVersion' => 1, |