Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSebastian L <sl@momou.ch>2021-05-05 00:41:54 +0300
committerSebastian L <sl@momou.ch>2021-05-10 10:42:47 +0300
commit74baa14c5c6d99cf1d49db7bf88b3ea884345f8a (patch)
treefd0a9970be54221bd0f6c22b204060bbce7e4b65 /tests
parentf549e525bcce69fafbf12c6e938bdf8ea49d2d8a (diff)
Provide multiple TURN servers to webrtc client
- Provides all in the backend specified turnservers to webrtc clients Signed-off-by: Sebastian L <sl@momou.ch>
Diffstat (limited to 'tests')
-rw-r--r--tests/php/ConfigTest.php75
1 files changed, 55 insertions, 20 deletions
diff --git a/tests/php/ConfigTest.php b/tests/php/ConfigTest.php
index c533e36f2..cc1c7a95b 100644
--- a/tests/php/ConfigTest.php
+++ b/tests/php/ConfigTest.php
@@ -117,13 +117,19 @@ class ConfigTest extends TestCase {
->willReturn(json_encode([
[
// No scheme explicitly given
- 'server' => 'turn.example.org',
+ 'server' => 'turn.example.org:3478',
'secret' => 'thisisasupersecretsecret',
'protocols' => 'udp,tcp',
],
[
'schemes' => 'turn,turns',
- 'server' => 'turn2.example.com',
+ 'server' => 'turn2.example.com:5349',
+ 'secret' => 'ThisIsAlsoSuperSecret',
+ 'protocols' => 'udp',
+ ],
+ [
+ 'schemes' => 'turns',
+ 'server' => 'turn-tls.example.com:443',
'secret' => 'ThisIsAlsoSuperSecret',
'protocols' => 'tcp',
],
@@ -149,24 +155,53 @@ class ConfigTest extends TestCase {
$helper = new Config($config, $secureRandom, $groupManager, $timeFactory);
//
- $server = $helper->getTurnSettings();
- if ($server['server'] === 'turn.example.org') {
- $this->assertSame([
- 'schemes' => 'turn',
- 'server' => 'turn.example.org',
- 'username' => '1479829425:abcdefghijklmnop',
- 'password' => '4VJLVbihLzuxgMfDrm5C3zy8kLQ=',
- 'protocols' => 'udp,tcp',
- ], $server);
- } else {
- $this->assertSame([
- 'schemes' => 'turn,turns',
- 'server' => 'turn2.example.com',
- 'username' => '1479829425:abcdefghijklmnop',
- 'password' => 'Ol9DEqnvyN4g+IAM+vFnqhfWUTE=',
- 'protocols' => 'tcp',
- ], $server);
- }
+ $settings = $helper->getTurnSettings();
+ $this->assertEquals(3, count($settings));
+ $this->assertSame([
+ 'schemes' => 'turn',
+ 'server' => 'turn.example.org:3478',
+ 'username' => '1479829425:abcdefghijklmnop',
+ 'password' => '4VJLVbihLzuxgMfDrm5C3zy8kLQ=',
+ 'protocols' => 'udp,tcp',
+ ], $settings[0]);
+ $this->assertSame([
+ 'schemes' => 'turn,turns',
+ 'server' => 'turn2.example.com:5349',
+ 'username' => '1479829425:abcdefghijklmnop',
+ 'password' => 'Ol9DEqnvyN4g+IAM+vFnqhfWUTE=',
+ 'protocols' => 'udp',
+ ], $settings[1]);
+ $this->assertSame([
+ 'schemes' => 'turns',
+ 'server' => 'turn-tls.example.com:443',
+ 'username' => '1479829425:abcdefghijklmnop',
+ 'password' => 'Ol9DEqnvyN4g+IAM+vFnqhfWUTE=',
+ 'protocols' => 'tcp',
+ ], $settings[2]);
+ }
+
+ public function testGenerateTurnSettingsEmpty() {
+ /** @var MockObject|IConfig $config */
+ $config = $this->createMock(IConfig::class);
+ $config
+ ->expects($this->once())
+ ->method('getAppValue')
+ ->with('spreed', 'turn_servers', '')
+ ->willReturn(json_encode([]));
+
+ /** @var MockObject|ITimeFactory $timeFactory */
+ $timeFactory = $this->createMock(ITimeFactory::class);
+
+ /** @var MockObject|IGroupManager $secureRandom */
+ $groupManager = $this->createMock(IGroupManager::class);
+
+ /** @var MockObject|ISecureRandom $secureRandom */
+ $secureRandom = $this->createMock(ISecureRandom::class);
+
+ $helper = new Config($config, $secureRandom, $groupManager, $timeFactory);
+
+ $settings = $helper->getTurnSettings();
+ $this->assertEquals(0, count($settings));
}
public function dataGetWebSocketDomainForSignalingServer() {