Browse Source

Merge pull request #19035 from nextcloud/bugfix/noid/increase-timeout-for-downloads

Adjust unit test for #19017
tags/v19.0.0beta1
Roeland Jago Douma 4 years ago
parent
commit
8056bbeae3
No account linked to committer's email address
1 changed files with 12 additions and 12 deletions
  1. 12
    12
      tests/lib/InstallerTest.php

+ 12
- 12
tests/lib/InstallerTest.php View File

$this->assertSame($updateAvailable, $installer->isUpdateAvailable('files'), 'Cached result should be returned and fetcher should be only called once'); $this->assertSame($updateAvailable, $installer->isUpdateAvailable('files'), 'Cached result should be returned and fetcher should be only called once');
} }


public function testDownloadAppWithRevokedCertificate() { public function testDownloadAppWithRevokedCertificate() {
$this->expectException(\Exception::class); $this->expectException(\Exception::class);
$this->expectExceptionMessage('Certificate "4112" has been revoked'); $this->expectExceptionMessage('Certificate "4112" has been revoked');
$installer->downloadApp('news'); $installer->downloadApp('news');
} }


public function testDownloadAppWithNotNextcloudCertificate() { public function testDownloadAppWithNotNextcloudCertificate() {
$this->expectException(\Exception::class); $this->expectException(\Exception::class);
$this->expectExceptionMessage('App with id news has a certificate not issued by a trusted Code Signing Authority'); $this->expectExceptionMessage('App with id news has a certificate not issued by a trusted Code Signing Authority');
$installer->downloadApp('news'); $installer->downloadApp('news');
} }


public function testDownloadAppWithDifferentCN() { public function testDownloadAppWithDifferentCN() {
$this->expectException(\Exception::class); $this->expectException(\Exception::class);
$this->expectExceptionMessage('App with id news has a cert issued to passman'); $this->expectExceptionMessage('App with id news has a cert issued to passman');
$installer->downloadApp('news'); $installer->downloadApp('news');
} }


public function testDownloadAppWithInvalidSignature() { public function testDownloadAppWithInvalidSignature() {
$this->expectException(\Exception::class); $this->expectException(\Exception::class);
$this->expectExceptionMessage('App with id passman has invalid signature'); $this->expectExceptionMessage('App with id passman has invalid signature');
$client $client
->expects($this->once()) ->expects($this->once())
->method('get') ->method('get')
->with('https://example.com', ['save_to' => $realTmpFile]);
->with('https://example.com', ['save_to' => $realTmpFile, 'timeout' => 120]);
$this->clientService $this->clientService
->expects($this->once()) ->expects($this->once())
->method('newClient') ->method('newClient')
$installer->downloadApp('passman'); $installer->downloadApp('passman');
} }


public function testDownloadAppWithMoreThanOneFolderDownloaded() { public function testDownloadAppWithMoreThanOneFolderDownloaded() {
$this->expectException(\Exception::class); $this->expectException(\Exception::class);
$this->expectExceptionMessage('Extracted app testapp has more than 1 folder'); $this->expectExceptionMessage('Extracted app testapp has more than 1 folder');
$client $client
->expects($this->once()) ->expects($this->once())
->method('get') ->method('get')
->with('https://example.com', ['save_to' => $realTmpFile]);
->with('https://example.com', ['save_to' => $realTmpFile, 'timeout' => 120]);
$this->clientService $this->clientService
->expects($this->once()) ->expects($this->once())
->method('newClient') ->method('newClient')
$installer->downloadApp('testapp'); $installer->downloadApp('testapp');
} }


public function testDownloadAppWithMismatchingIdentifier() { public function testDownloadAppWithMismatchingIdentifier() {
$this->expectException(\Exception::class); $this->expectException(\Exception::class);
$this->expectExceptionMessage('App for id testapp has a wrong app ID in info.xml: testapp1'); $this->expectExceptionMessage('App for id testapp has a wrong app ID in info.xml: testapp1');
$client $client
->expects($this->once()) ->expects($this->once())
->method('get') ->method('get')
->with('https://example.com', ['save_to' => $realTmpFile]);
->with('https://example.com', ['save_to' => $realTmpFile, 'timeout' => 120]);
$this->clientService $this->clientService
->expects($this->once()) ->expects($this->once())
->method('newClient') ->method('newClient')
$client $client
->expects($this->once()) ->expects($this->once())
->method('get') ->method('get')
->with('https://example.com', ['save_to' => $realTmpFile]);
->with('https://example.com', ['save_to' => $realTmpFile, 'timeout' => 120]);
$this->clientService $this->clientService
->expects($this->at(0)) ->expects($this->at(0))
->method('newClient') ->method('newClient')
$this->assertEquals('0.9', \OC_App::getAppVersionByPath(__DIR__ . '/../../apps/testapp/')); $this->assertEquals('0.9', \OC_App::getAppVersionByPath(__DIR__ . '/../../apps/testapp/'));
} }


public function testDownloadAppWithDowngrade() { public function testDownloadAppWithDowngrade() {
$this->expectException(\Exception::class); $this->expectException(\Exception::class);
$this->expectExceptionMessage('App for id testapp has version 0.9 and tried to update to lower version 0.8'); $this->expectExceptionMessage('App for id testapp has version 0.9 and tried to update to lower version 0.8');
$client $client
->expects($this->once()) ->expects($this->once())
->method('get') ->method('get')
->with('https://example.com', ['save_to' => $realTmpFile]);
->with('https://example.com', ['save_to' => $realTmpFile, 'timeout' => 120]);
$this->clientService $this->clientService
->expects($this->at(1)) ->expects($this->at(1))
->method('newClient') ->method('newClient')

Loading…
Cancel
Save