summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2016-10-27 17:41:15 +0200
committerLukas Reschke <lukas@statuscode.ch>2016-10-31 17:17:44 +0100
commit32cf661215fb3926789054a3953b465fc2665330 (patch)
tree4cf2865bef5856c59a1fdacb98208a14dfc1a128 /tests
parent357a823457397d3e93ec8cd4dc01fb6859eb0049 (diff)
downloadnextcloud-server-32cf661215fb3926789054a3953b465fc2665330.tar.gz
nextcloud-server-32cf661215fb3926789054a3953b465fc2665330.zip
Use new appstore API
This change introduces the new appstore API in Nextcloud. Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
Diffstat (limited to 'tests')
-rw-r--r--tests/Settings/Controller/AppSettingsControllerTest.php231
-rw-r--r--tests/lib/App/AppStore/Fetcher/AppFetcherTest.php39
-rw-r--r--tests/lib/App/AppStore/Fetcher/CategoryFetcherTest.php38
-rw-r--r--tests/lib/App/AppStore/Fetcher/FetcherBase.php246
-rw-r--r--tests/lib/App/AppStore/Version/VersionParserTest.php84
-rw-r--r--tests/lib/App/AppStore/Version/VersionTest.php37
-rw-r--r--tests/lib/OCSClientTest.php1132
-rw-r--r--tests/lib/ServerTest.php2
8 files changed, 518 insertions, 1291 deletions
diff --git a/tests/Settings/Controller/AppSettingsControllerTest.php b/tests/Settings/Controller/AppSettingsControllerTest.php
index 9dcc55e135b..fc9d04fcfe7 100644
--- a/tests/Settings/Controller/AppSettingsControllerTest.php
+++ b/tests/Settings/Controller/AppSettingsControllerTest.php
@@ -2,6 +2,7 @@
/**
* @author Lukas Reschke <lukas@owncloud.com>
*
+ * @copyright Copyright (c) 2016, Lukas Reschke <lukas@statuscode.ch>
* @copyright Copyright (c) 2015, ownCloud, Inc.
* @license AGPL-3.0
*
@@ -21,10 +22,13 @@
namespace Tests\Settings\Controller;
+use OC\App\AppStore\Fetcher\AppFetcher;
+use OC\App\AppStore\Fetcher\CategoryFetcher;
use OC\Settings\Controller\AppSettingsController;
use OCP\AppFramework\Http\ContentSecurityPolicy;
-use OCP\AppFramework\Http\DataResponse;
+use OCP\AppFramework\Http\JSONResponse;
use OCP\AppFramework\Http\TemplateResponse;
+use OCP\ICacheFactory;
use Test\TestCase;
use OCP\IRequest;
use OCP\IL10N;
@@ -32,7 +36,6 @@ use OCP\IConfig;
use OCP\ICache;
use OCP\INavigationManager;
use OCP\App\IAppManager;
-use OC\OCSClient;
/**
* Class AppSettingsControllerTest
@@ -42,49 +45,43 @@ use OC\OCSClient;
class AppSettingsControllerTest extends TestCase {
/** @var AppSettingsController */
private $appSettingsController;
- /** @var IRequest */
+ /** @var IRequest|\PHPUnit_Framework_MockObject_MockObject */
private $request;
- /** @var IL10N */
+ /** @var IL10N|\PHPUnit_Framework_MockObject_MockObject */
private $l10n;
- /** @var IConfig */
+ /** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */
private $config;
- /** @var ICache */
+ /** @var ICache|\PHPUnit_Framework_MockObject_MockObject */
private $cache;
- /** @var INavigationManager */
+ /** @var INavigationManager|\PHPUnit_Framework_MockObject_MockObject */
private $navigationManager;
- /** @var IAppManager */
+ /** @var IAppManager|\PHPUnit_Framework_MockObject_MockObject */
private $appManager;
- /** @var OCSClient */
- private $ocsClient;
+ /** @var CategoryFetcher|\PHPUnit_Framework_MockObject_MockObject */
+ private $categoryFetcher;
+ /** @var AppFetcher|\PHPUnit_Framework_MockObject_MockObject */
+ private $appFetcher;
public function setUp() {
parent::setUp();
- $this->request = $this->getMockBuilder('\OCP\IRequest')
- ->disableOriginalConstructor()->getMock();
- $this->l10n = $this->getMockBuilder('\OCP\IL10N')
- ->disableOriginalConstructor()->getMock();
+ $this->request = $this->createMock(IRequest::class);
+ $this->l10n = $this->createMock(IL10N::class);
$this->l10n->expects($this->any())
->method('t')
->will($this->returnArgument(0));
- $this->config = $this->getMockBuilder('\OCP\IConfig')
- ->disableOriginalConstructor()->getMock();
- $cacheFactory = $this->getMockBuilder('\OCP\ICacheFactory')
- ->disableOriginalConstructor()->getMock();
- $this->cache = $this->getMockBuilder('\OCP\ICache')
- ->disableOriginalConstructor()->getMock();
+ $this->config = $this->createMock(IConfig::class);
+ $cacheFactory = $this->createMock(ICacheFactory::class);
+ $this->cache = $this->createMock(ICache::class);
$cacheFactory
->expects($this->once())
->method('create')
->with('settings')
->will($this->returnValue($this->cache));
-
- $this->navigationManager = $this->getMockBuilder('\OCP\INavigationManager')
- ->disableOriginalConstructor()->getMock();
- $this->appManager = $this->getMockBuilder('\OCP\App\IAppManager')
- ->disableOriginalConstructor()->getMock();
- $this->ocsClient = $this->getMockBuilder('\OC\OCSClient')
- ->disableOriginalConstructor()->getMock();
+ $this->navigationManager = $this->createMock(INavigationManager::class);
+ $this->appManager = $this->createMock(IAppManager::class);
+ $this->categoryFetcher = $this->createMock(CategoryFetcher::class);
+ $this->appFetcher = $this->createMock(AppFetcher::class);
$this->appSettingsController = new AppSettingsController(
'settings',
@@ -94,43 +91,13 @@ class AppSettingsControllerTest extends TestCase {
$cacheFactory,
$this->navigationManager,
$this->appManager,
- $this->ocsClient
+ $this->categoryFetcher,
+ $this->appFetcher
);
}
- public function testChangeExperimentalConfigStateTrue() {
- $this->config
- ->expects($this->once())
- ->method('setSystemValue')
- ->with('appstore.experimental.enabled', true);
- $this->appManager
- ->expects($this->once())
- ->method('clearAppsCache');
- $this->assertEquals(new DataResponse(), $this->appSettingsController->changeExperimentalConfigState(true));
- }
-
- public function testChangeExperimentalConfigStateFalse() {
- $this->config
- ->expects($this->once())
- ->method('setSystemValue')
- ->with('appstore.experimental.enabled', false);
- $this->appManager
- ->expects($this->once())
- ->method('clearAppsCache');
- $this->assertEquals(new DataResponse(), $this->appSettingsController->changeExperimentalConfigState(false));
- }
-
- public function testListCategoriesCached() {
- $this->cache
- ->expects($this->exactly(2))
- ->method('get')
- ->with('listCategories')
- ->will($this->returnValue(['CachedArray']));
- $this->assertSame(['CachedArray'], $this->appSettingsController->listCategories());
- }
-
- public function testListCategoriesNotCachedWithoutAppStore() {
- $expected = [
+ public function testListCategories() {
+ $expected = new JSONResponse([
[
'id' => 0,
'ident' => 'enabled',
@@ -141,115 +108,69 @@ class AppSettingsControllerTest extends TestCase {
'ident' => 'disabled',
'displayName' => 'Not enabled',
],
- ];
- $this->cache
- ->expects($this->once())
- ->method('get')
- ->with('listCategories')
- ->will($this->returnValue(null));
- $this->cache
- ->expects($this->once())
- ->method('set')
- ->with('listCategories', $expected, 3600);
-
-
- $this->assertSame($expected, $this->appSettingsController->listCategories());
- }
-
- public function testListCategoriesNotCachedWithAppStore() {
- $expected = [
[
- 'id' => 0,
- 'ident' => 'enabled',
- 'displayName' => 'Enabled',
+ 'id' => 'auth',
+ 'ident' => 'auth',
+ 'displayName' => 'Authentication & authorization',
],
[
- 'id' => 1,
- 'ident' => 'disabled',
- 'displayName' => 'Not enabled',
+ 'id' => 'customization',
+ 'ident' => 'customization',
+ 'displayName' => 'Customization',
],
[
- 'id' => 0,
- 'ident' => 'tools',
- 'displayName' => 'Tools',
+ 'id' => 'files',
+ 'ident' => 'files',
+ 'displayName' => 'Files',
],
[
- 'id' => 1,
- 'ident' => 'games',
- 'displayName' => 'Games',
+ 'id' => 'integration',
+ 'ident' => 'integration',
+ 'displayName' => 'Integration',
],
[
- 'id' => 2,
- 'ident' => 'productivity',
- 'displayName' => 'Productivity',
+ 'id' => 'monitoring',
+ 'ident' => 'monitoring',
+ 'displayName' => 'Monitoring',
],
[
- 'id' => 3,
+ 'id' => 'multimedia',
'ident' => 'multimedia',
'displayName' => 'Multimedia',
],
- ];
+ [
+ 'id' => 'office',
+ 'ident' => 'office',
+ 'displayName' => 'Office & text',
+ ],
+ [
+ 'id' => 'organization',
+ 'ident' => 'organization',
+ 'displayName' => 'Organization',
+ ],
+ [
+ 'id' => 'social',
+ 'ident' => 'social',
+ 'displayName' => 'Social & communication',
+ ],
+ [
+ 'id' => 'tools',
+ 'ident' => 'tools',
+ 'displayName' => 'Tools',
+ ],
+ ]);
- $this->cache
+ $this->categoryFetcher
->expects($this->once())
->method('get')
- ->with('listCategories')
- ->will($this->returnValue(null));
- $this->cache
- ->expects($this->once())
- ->method('set')
- ->with('listCategories', $expected, 3600);
+ ->willReturn(json_decode('[{"id":"auth","translations":{"cs":{"name":"Autentizace & autorizace","description":"Aplikace poskytující služby dodatečného ověření nebo přihlášení"},"hu":{"name":"Azonosítás és hitelesítés","description":"Apps that provide additional authentication or authorization services"},"de":{"name":"Authentifizierung & Authorisierung","description":"Apps die zusätzliche Autentifizierungs- oder Autorisierungsdienste bereitstellen"},"nl":{"name":"Authenticatie & authorisatie","description":"Apps die aanvullende authenticatie- en autorisatiediensten bieden"},"nb":{"name":"Pålogging og tilgangsstyring","description":"Apper for å tilby ekstra pålogging eller tilgangsstyring"},"it":{"name":"Autenticazione e autorizzazione","description":"Apps that provide additional authentication or authorization services"},"fr":{"name":"Authentification et autorisations","description":"Applications qui fournissent des services d\'authentification ou d\'autorisations additionnels."},"ru":{"name":"Аутентификация и авторизация","description":"Apps that provide additional authentication or authorization services"},"en":{"name":"Authentication & authorization","description":"Apps that provide additional authentication or authorization services"}}},{"id":"customization","translations":{"cs":{"name":"Přizpůsobení","description":"Motivy a aplikace měnící rozvržení a uživatelské rozhraní"},"it":{"name":"Personalizzazione","description":"Applicazioni di temi, modifiche della disposizione e UX"},"de":{"name":"Anpassung","description":"Apps zur Änderung von Themen, Layout und Benutzererfahrung"},"hu":{"name":"Személyre szabás","description":"Témák, elrendezések felhasználói felület módosító alkalmazások"},"nl":{"name":"Maatwerk","description":"Thema\'s, layout en UX aanpassingsapps"},"nb":{"name":"Tilpasning","description":"Apper for å endre Tema, utseende og brukeropplevelse"},"fr":{"name":"Personalisation","description":"Thèmes, apparence et applications modifiant l\'expérience utilisateur"},"ru":{"name":"Настройка","description":"Themes, layout and UX change apps"},"en":{"name":"Customization","description":"Themes, layout and UX change apps"}}},{"id":"files","translations":{"cs":{"name":"Soubory","description":"Aplikace rozšiřující správu souborů nebo aplikaci Soubory"},"it":{"name":"File","description":"Applicazioni di gestione dei file ed estensione dell\'applicazione FIle"},"de":{"name":"Dateien","description":"Dateimanagement sowie Erweiterungs-Apps für die Dateien-App"},"hu":{"name":"Fájlok","description":"Fájl kezelő és kiegészítő alkalmazások"},"nl":{"name":"Bestanden","description":"Bestandebeheer en uitbreidingen van bestand apps"},"nb":{"name":"Filer","description":"Apper for filhåndtering og filer"},"fr":{"name":"Fichiers","description":"Applications de gestion de fichiers et extensions à l\'application Fichiers"},"ru":{"name":"Файлы","description":"Расширение: файлы и управление файлами"},"en":{"name":"Files","description":"File management and Files app extension apps"}}},{"id":"integration","translations":{"it":{"name":"Integrazione","description":"Applicazioni che collegano Nextcloud con altri servizi e piattaforme"},"hu":{"name":"Integráció","description":"Apps that connect Nextcloud with other services and platforms"},"nl":{"name":"Integratie","description":"Apps die Nextcloud verbinden met andere services en platformen"},"nb":{"name":"Integrasjon","description":"Apper som kobler Nextcloud med andre tjenester og plattformer"},"de":{"name":"Integration","description":"Apps die Nextcloud mit anderen Diensten und Plattformen verbinden"},"cs":{"name":"Propojení","description":"Aplikace propojující NextCloud s dalšími službami a platformami"},"fr":{"name":"Intégration","description":"Applications qui connectent Nextcloud avec d\'autres services et plateformes"},"ru":{"name":"Интеграция","description":"Приложения, соединяющие Nextcloud с другими службами и платформами"},"en":{"name":"Integration","description":"Apps that connect Nextcloud with other services and platforms"}}},{"id":"monitoring","translations":{"nb":{"name":"Overvåking","description":"Apper for statistikk, systemdiagnose og aktivitet"},"it":{"name":"Monitoraggio","description":"Applicazioni di statistiche, diagnostica di sistema e attività"},"de":{"name":"Überwachung","description":"Datenstatistiken-, Systemdiagnose- und Aktivitäten-Apps"},"hu":{"name":"Megfigyelés","description":"Data statistics, system diagnostics and activity apps"},"nl":{"name":"Monitoren","description":"Gegevensstatistiek, systeem diagnose en activiteit apps"},"cs":{"name":"Kontrola","description":"Datové statistiky, diagnózy systému a aktivity aplikací"},"fr":{"name":"Surveillance","description":"Applications de statistiques sur les données, de diagnostics systèmes et d\'activité."},"ru":{"name":"Мониторинг","description":"Статистика данных, диагностика системы и активность приложений"},"en":{"name":"Monitoring","description":"Data statistics, system diagnostics and activity apps"}}},{"id":"multimedia","translations":{"nb":{"name":"Multimedia","description":"Apper for lyd, film og bilde"},"it":{"name":"Multimedia","description":"Applicazioni per audio, video e immagini"},"de":{"name":"Multimedia","description":"Audio-, Video- und Bilder-Apps"},"hu":{"name":"Multimédia","description":"Hang, videó és kép alkalmazások"},"nl":{"name":"Multimedia","description":"Audio, video en afbeelding apps"},"en":{"name":"Multimedia","description":"Audio, video and picture apps"},"cs":{"name":"Multimédia","description":"Aplikace audia, videa a obrázků"},"fr":{"name":"Multimédia","description":"Applications audio, vidéo et image"},"ru":{"name":"Мультимедиа","description":"Приложение аудио, видео и изображения"}}},{"id":"office","translations":{"nb":{"name":"Kontorstøtte og tekst","description":"Apper for Kontorstøtte og tekstbehandling"},"it":{"name":"Ufficio e testo","description":"Applicazione per ufficio ed elaborazione di testi"},"de":{"name":"Büro & Text","description":"Büro- und Textverarbeitungs-Apps"},"hu":{"name":"Iroda és szöveg","description":"Irodai és szöveg feldolgozó alkalmazások"},"nl":{"name":"Office & tekst","description":"Office en tekstverwerkingsapps"},"cs":{"name":"Kancelář a text","description":"Aplikace pro kancelář a zpracování textu"},"fr":{"name":"Bureautique & texte","description":"Applications de bureautique et de traitement de texte"},"en":{"name":"Office & text","description":"Office and text processing apps"}}},{"id":"organization","translations":{"nb":{"name":"Organisering","description":"Apper for tidsstyring, oppgaveliste og kalender"},"it":{"name":"Organizzazione","description":"Applicazioni di gestione del tempo, elenco delle cose da fare e calendario"},"hu":{"name":"Szervezet","description":"Időbeosztás, teendő lista és naptár alkalmazások"},"nl":{"name":"Organisatie","description":"Tijdmanagement, takenlijsten en agenda apps"},"cs":{"name":"Organizace","description":"Aplikace pro správu času, plánování a kalendáře"},"de":{"name":"Organisation","description":"Time management, Todo list and calendar apps"},"fr":{"name":"Organisation","description":"Applications de gestion du temps, de listes de tâches et d\'agendas"},"ru":{"name":"Организация","description":"Приложения по управлению временем, список задач и календарь"},"en":{"name":"Organization","description":"Time management, Todo list and calendar apps"}}},{"id":"social","translations":{"nb":{"name":"Sosialt og kommunikasjon","description":"Apper for meldinger, kontakthåndtering og sosiale medier"},"it":{"name":"Sociale e comunicazione","description":"Applicazioni di messaggistica, gestione dei contatti e reti sociali"},"de":{"name":"Kommunikation","description":"Nachrichten-, Kontaktverwaltungs- und Social-Media-Apps"},"hu":{"name":"Közösségi és kommunikáció","description":"Üzenetküldő, kapcsolat kezelő és közösségi média alkalmazások"},"nl":{"name":"Sociaal & communicatie","description":"Messaging, contactbeheer en social media apps"},"cs":{"name":"Sociální sítě a komunikace","description":"Aplikace pro zasílání zpráv, správu kontaktů a sociální sítě"},"fr":{"name":"Social & communication","description":"Applications de messagerie, de gestion de contacts et de réseaux sociaux"},"ru":{"name":"Социальное и связь","description":"Общение, управление контактами и социальное медиа-приложение"},"en":{"name":"Social & communication","description":"Messaging, contact management and social media apps"}}},{"id":"tools","translations":{"nb":{"name":"Verktøy","description":"Alt annet"},"it":{"name":"Strumenti","description":"Tutto il resto"},"hu":{"name":"Eszközök","description":"Minden más"},"nl":{"name":"Tools","description":"De rest"},"de":{"name":"Werkzeuge","description":"Alles Andere"},"en":{"name":"Tools","description":"Everything else"},"cs":{"name":"Nástroje","description":"Vše ostatní"},"fr":{"name":"Outils","description":"Tout le reste"},"ru":{"name":"Приложения","description":"Что-то еще"}}}]', true));
- $this->ocsClient
- ->expects($this->once())
- ->method('isAppStoreEnabled')
- ->will($this->returnValue(true));
- $this->ocsClient
- ->expects($this->once())
- ->method('getCategories')
- ->will($this->returnValue(
- [
- 'ownCloud Tools',
- 'Games',
- 'ownCloud Productivity',
- 'Multimedia',
- ]
- ));
-
- $this->assertSame($expected, $this->appSettingsController->listCategories());
+ $this->assertEquals($expected, $this->appSettingsController->listCategories());
}
public function testViewApps() {
$this->config
- ->expects($this->at(0))
- ->method('getSystemValue')
- ->with('appstore.experimental.enabled', false);
- $this->config
- ->expects($this->at(1))
- ->method('getSystemValue')
- ->with('appstoreenabled', true)
- ->will($this->returnValue(true));
- $this->navigationManager
->expects($this->once())
- ->method('setActiveEntry')
- ->with('core_apps');
-
- $policy = new ContentSecurityPolicy();
- $policy->addAllowedImageDomain('https://apps.owncloud.com');
-
- $expected = new TemplateResponse('settings', 'apps', ['experimentalEnabled' => false, 'category' => 'enabled', 'appstoreEnabled' => true], 'user');
- $expected->setContentSecurityPolicy($policy);
-
- $this->assertEquals($expected, $this->appSettingsController->viewApps());
- }
-
- public function testViewAppsNotEnabled() {
- $this->config
- ->expects($this->at(0))
- ->method('getSystemValue')
- ->with('appstore.experimental.enabled', false);
- $this->config
- ->expects($this->at(1))
->method('getSystemValue')
->with('appstoreenabled', true)
->will($this->returnValue(true));
@@ -259,21 +180,17 @@ class AppSettingsControllerTest extends TestCase {
->with('core_apps');
$policy = new ContentSecurityPolicy();
- $policy->addAllowedImageDomain('https://apps.owncloud.com');
+ $policy->addAllowedImageDomain('*');
- $expected = new TemplateResponse('settings', 'apps', ['experimentalEnabled' => false, 'category' => 'disabled', 'appstoreEnabled' => true], 'user');
+ $expected = new TemplateResponse('settings', 'apps', ['category' => 'enabled', 'appstoreEnabled' => true], 'user');
$expected->setContentSecurityPolicy($policy);
- $this->assertEquals($expected, $this->appSettingsController->viewApps('disabled'));
+ $this->assertEquals($expected, $this->appSettingsController->viewApps());
}
public function testViewAppsAppstoreNotEnabled() {
$this->config
- ->expects($this->at(0))
- ->method('getSystemValue')
- ->with('appstore.experimental.enabled', false);
- $this->config
- ->expects($this->at(1))
+ ->expects($this->once())
->method('getSystemValue')
->with('appstoreenabled', true)
->will($this->returnValue(false));
@@ -283,9 +200,9 @@ class AppSettingsControllerTest extends TestCase {
->with('core_apps');
$policy = new ContentSecurityPolicy();
- $policy->addAllowedImageDomain('https://apps.owncloud.com');
+ $policy->addAllowedImageDomain('*');
- $expected = new TemplateResponse('settings', 'apps', ['experimentalEnabled' => false, 'category' => 'enabled', 'appstoreEnabled' => false], 'user');
+ $expected = new TemplateResponse('settings', 'apps', ['category' => 'enabled', 'appstoreEnabled' => false], 'user');
$expected->setContentSecurityPolicy($policy);
$this->assertEquals($expected, $this->appSettingsController->viewApps());
diff --git a/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php b/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php
new file mode 100644
index 00000000000..3b0418a7eba
--- /dev/null
+++ b/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php
@@ -0,0 +1,39 @@
+<?php
+/**
+ * @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace Test\App\AppStore\Fetcher;
+
+use OC\App\AppStore\Fetcher\AppFetcher;
+
+class AppFetcherTest extends FetcherBase {
+ public function setUp() {
+ parent::setUp();
+ $this->fileName = 'apps.json';
+ $this->endpoint = 'https://apps.nextcloud.com/api/v1/platform/9.2.0/apps.json';
+
+ $this->fetcher = new AppFetcher(
+ $this->appData,
+ $this->clientService,
+ $this->timeFactory,
+ $this->config
+ );
+ }
+}
diff --git a/tests/lib/App/AppStore/Fetcher/CategoryFetcherTest.php b/tests/lib/App/AppStore/Fetcher/CategoryFetcherTest.php
new file mode 100644
index 00000000000..db4354119a0
--- /dev/null
+++ b/tests/lib/App/AppStore/Fetcher/CategoryFetcherTest.php
@@ -0,0 +1,38 @@
+<?php
+/**
+ * @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace Test\App\AppStore\Fetcher;
+
+use OC\App\AppStore\Fetcher\CategoryFetcher;
+
+class CategoryFetcherTest extends FetcherBase {
+ public function setUp() {
+ parent::setUp();
+ $this->fileName = 'categories.json';
+ $this->endpoint = 'https://apps.nextcloud.com/api/v1/categories.json';
+
+ $this->fetcher = new CategoryFetcher(
+ $this->appData,
+ $this->clientService,
+ $this->timeFactory
+ );
+ }
+}
diff --git a/tests/lib/App/AppStore/Fetcher/FetcherBase.php b/tests/lib/App/AppStore/Fetcher/FetcherBase.php
new file mode 100644
index 00000000000..66df81f1b2e
--- /dev/null
+++ b/tests/lib/App/AppStore/Fetcher/FetcherBase.php
@@ -0,0 +1,246 @@
+<?php
+/**
+ * @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace Test\App\AppStore\Fetcher;
+
+use OC\App\AppStore\Fetcher\AppFetcher;
+use OC\App\AppStore\Fetcher\Fetcher;
+use OCP\AppFramework\Utility\ITimeFactory;
+use OCP\Files\IAppData;
+use OCP\Files\NotFoundException;
+use OCP\Files\SimpleFS\ISimpleFile;
+use OCP\Files\SimpleFS\ISimpleFolder;
+use OCP\Http\Client\IClient;
+use OCP\Http\Client\IClientService;
+use OCP\Http\Client\IResponse;
+use OCP\IConfig;
+use Test\TestCase;
+
+abstract class FetcherBase extends TestCase {
+ /** @var IAppData|\PHPUnit_Framework_MockObject_MockObject */
+ protected $appData;
+ /** @var IClientService|\PHPUnit_Framework_MockObject_MockObject */
+ protected $clientService;
+ /** @var ITimeFactory|\PHPUnit_Framework_MockObject_MockObject */
+ protected $timeFactory;
+ /** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */
+ protected $config;
+ /** @var Fetcher */
+ protected $fetcher;
+ /** @var string */
+ protected $fileName;
+ /** @var string */
+ protected $endpoint;
+
+ public function setUp() {
+ parent::setUp();
+ $this->appData = $this->createMock(IAppData::class);
+ $this->clientService = $this->createMock(IClientService::class);
+ $this->timeFactory = $this->createMock(ITimeFactory::class);
+ $this->config = $this->createMock(IConfig::class);
+ }
+
+ public function testGetWithAlreadyExistingFileAndUpToDateTimestamp() {
+ $folder = $this->createMock(ISimpleFolder::class);
+ $file = $this->createMock(ISimpleFile::class);
+ $this->appData
+ ->expects($this->once())
+ ->method('getFolder')
+ ->with('/')
+ ->willReturn($folder);
+ $folder
+ ->expects($this->once())
+ ->method('getFile')
+ ->with($this->fileName)
+ ->willReturn($file);
+ $file
+ ->expects($this->once())
+ ->method('getContent')
+ ->willReturn('{"timestamp":1200,"data":[{"id":"MyApp"}]}');
+ $this->timeFactory
+ ->expects($this->once())
+ ->method('getTime')
+ ->willReturn(1499);
+
+ $expected = [
+ [
+ 'id' => 'MyApp',
+ ],
+ ];
+ $this->assertSame($expected, $this->fetcher->get());
+ }
+
+ public function testGetWithNotExistingFileAndUpToDateTimestamp() {
+ $folder = $this->createMock(ISimpleFolder::class);
+ $file = $this->createMock(ISimpleFile::class);
+ $this->appData
+ ->expects($this->once())
+ ->method('getFolder')
+ ->with('/')
+ ->willReturn($folder);
+ $folder
+ ->expects($this->at(0))
+ ->method('getFile')
+ ->with($this->fileName)
+ ->willThrowException(new NotFoundException());
+ $folder
+ ->expects($this->at(1))
+ ->method('newFile')
+ ->with($this->fileName)
+ ->willReturn($file);
+ $client = $this->createMock(IClient::class);
+ $this->clientService
+ ->expects($this->once())
+ ->method('newClient')
+ ->willReturn($client);
+ $response = $this->createMock(IResponse::class);
+ $client
+ ->expects($this->once())
+ ->method('get')
+ ->with($this->endpoint)
+ ->willReturn($response);
+ $response
+ ->expects($this->once())
+ ->method('getBody')
+ ->willReturn('[{"id":"MyNewApp", "foo": "foo"}, {"id":"bar"}]');
+ $fileData = '{"data":[{"id":"MyNewApp","foo":"foo"},{"id":"bar"}],"timestamp":1502}';
+ $file
+ ->expects($this->at(0))
+ ->method('putContent')
+ ->with($fileData);
+ $file
+ ->expects($this->at(1))
+ ->method('getContent')
+ ->willReturn($fileData);
+ $this->timeFactory
+ ->expects($this->at(0))
+ ->method('getTime')
+ ->willReturn(1502);
+
+ $expected = [
+ [
+ 'id' => 'MyNewApp',
+ 'foo' => 'foo',
+ ],
+ [
+ 'id' => 'bar',
+ ],
+ ];
+ $this->assertSame($expected, $this->fetcher->get());
+ }
+
+ public function testGetWithAlreadyExistingFileAndOutdatedTimestamp() {
+ $folder = $this->createMock(ISimpleFolder::class);
+ $file = $this->createMock(ISimpleFile::class);
+ $this->appData
+ ->expects($this->once())
+ ->method('getFolder')
+ ->with('/')
+ ->willReturn($folder);
+ $folder
+ ->expects($this->once())
+ ->method('getFile')
+ ->with($this->fileName)
+ ->willReturn($file);
+ $file
+ ->expects($this->at(0))
+ ->method('getContent')
+ ->willReturn('{"timestamp":1200,"data":{"MyApp":{"id":"MyApp"}}}');
+ $this->timeFactory
+ ->expects($this->at(0))
+ ->method('getTime')
+ ->willReturn(1501);
+ $client = $this->createMock(IClient::class);
+ $this->clientService
+ ->expects($this->once())
+ ->method('newClient')
+ ->willReturn($client);
+ $response = $this->createMock(IResponse::class);
+ $client
+ ->expects($this->once())
+ ->method('get')
+ ->with($this->endpoint)
+ ->willReturn($response);
+ $response
+ ->expects($this->once())
+ ->method('getBody')
+ ->willReturn('[{"id":"MyNewApp", "foo": "foo"}, {"id":"bar"}]');
+ $fileData = '{"data":[{"id":"MyNewApp","foo":"foo"},{"id":"bar"}],"timestamp":1502}';
+ $file
+ ->expects($this->at(1))
+ ->method('putContent')
+ ->with($fileData);
+ $file
+ ->expects($this->at(2))
+ ->method('getContent')
+ ->willReturn($fileData);
+ $this->timeFactory
+ ->expects($this->at(1))
+ ->method('getTime')
+ ->willReturn(1502);
+
+ $expected = [
+ [
+ 'id' => 'MyNewApp',
+ 'foo' => 'foo',
+ ],
+ [
+ 'id' => 'bar',
+ ],
+ ];
+ $this->assertSame($expected, $this->fetcher->get());
+ }
+
+ public function testGetWithExceptionInClient() {
+ $folder = $this->createMock(ISimpleFolder::class);
+ $file = $this->createMock(ISimpleFile::class);
+ $this->appData
+ ->expects($this->once())
+ ->method('getFolder')
+ ->with('/')
+ ->willReturn($folder);
+ $folder
+ ->expects($this->once())
+ ->method('getFile')
+ ->with($this->fileName)
+ ->willReturn($file);
+ $file
+ ->expects($this->at(0))
+ ->method('getContent')
+ ->willReturn('{"timestamp":1200,"data":{"MyApp":{"id":"MyApp"}}}');
+ $this->timeFactory
+ ->expects($this->at(0))
+ ->method('getTime')
+ ->willReturn(1501);
+ $client = $this->createMock(IClient::class);
+ $this->clientService
+ ->expects($this->once())
+ ->method('newClient')
+ ->willReturn($client);
+ $client
+ ->expects($this->once())
+ ->method('get')
+ ->with($this->endpoint)
+ ->willThrowException(new \Exception());
+
+ $this->assertSame([], $this->fetcher->get());
+ }
+}
diff --git a/tests/lib/App/AppStore/Version/VersionParserTest.php b/tests/lib/App/AppStore/Version/VersionParserTest.php
new file mode 100644
index 00000000000..ccf557eefbc
--- /dev/null
+++ b/tests/lib/App/AppStore/Version/VersionParserTest.php
@@ -0,0 +1,84 @@
+<?php
+/**
+ * @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace Test\App\AppStore\Version;
+
+use OC\App\AppStore\Version\Version;
+use OC\App\AppStore\Version\VersionParser;
+use Test\TestCase;
+
+class VersionParserTest extends TestCase {
+ /** @var VersionParser */
+ private $versionParser;
+
+ public function setUp() {
+ parent::setUp();
+ $this->versionParser = new VersionParser();
+ }
+
+ /**
+ * @return array
+ */
+ public function versionProvider() {
+ return [
+ [
+ '*',
+ new Version('', ''),
+ ],
+ [
+ '<=8.1.2',
+ new Version('', '8.1.2'),
+ ],
+ [
+ '<=9',
+ new Version('', '9'),
+ ],
+ [
+ '>=9.3.2',
+ new Version('9.3.2', ''),
+ ],
+ [
+ '>=8.1.2 <=9.3.2',
+ new Version('8.1.2', '9.3.2'),
+ ],
+ [
+ '>=8.2 <=9.1',
+ new Version('8.2', '9.1'),
+ ],
+ [
+ '>=9 <=11',
+ new Version('9', '11'),
+ ],
+ ];
+ }
+
+ /**
+ * @dataProvider versionProvider
+ *
+ * @param string $input
+ * @param Version $expected
+ */
+ public function testGetVersion($input,
+ Version $expected) {
+ $this->assertEquals($expected, $this->versionParser->getVersion($input));
+ }
+
+}
diff --git a/tests/lib/App/AppStore/Version/VersionTest.php b/tests/lib/App/AppStore/Version/VersionTest.php
new file mode 100644
index 00000000000..969c96a57a8
--- /dev/null
+++ b/tests/lib/App/AppStore/Version/VersionTest.php
@@ -0,0 +1,37 @@
+<?php
+/**
+ * @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace Test\App\AppStore\Version;
+
+use OC\App\AppStore\Version\Version;
+use Test\TestCase;
+
+class VersionTest extends TestCase {
+ public function testGetMinimumVersion() {
+ $version = new Version('9', '10');
+ $this->assertSame('9', $version->getMinimumVersion());
+ }
+
+ public function testGetMaximumVersion() {
+ $version = new Version('9', '10');
+ $this->assertSame('10', $version->getMaximumVersion());
+ }
+}
diff --git a/tests/lib/OCSClientTest.php b/tests/lib/OCSClientTest.php
deleted file mode 100644
index d4bfd77e871..00000000000
--- a/tests/lib/OCSClientTest.php
+++ /dev/null
@@ -1,1132 +0,0 @@
-<?php
-/**
- * @author Lukas Reschke <lukas@owncloud.com>
- *
- * @copyright Copyright (c) 2015, ownCloud, Inc.
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
- */
-
-namespace Test;
-
-use OC\OCSClient;
-use OCP\Http\Client\IClient;
-use OCP\Http\Client\IClientService;
-use OCP\Http\Client\IResponse;
-use OCP\IConfig;
-use OCP\ILogger;
-
-/**
- * Class OCSClientTest
- */
-class OCSClientTest extends \Test\TestCase {
- /** @var OCSClient */
- private $ocsClient;
- /** @var IConfig */
- private $config;
- /** @var IClientService */
- private $clientService;
- /** @var ILogger */
- private $logger;
-
- public function setUp() {
- parent::setUp();
-
- $this->config = $this->getMockBuilder('\OCP\IConfig')
- ->disableOriginalConstructor()->getMock();
- $this->clientService = $this->createMock(IClientService::class);
- $this->logger = $this->createMock(ILogger::class);
-
- $this->ocsClient = new OCSClient(
- $this->clientService,
- $this->config,
- $this->logger
- );
- }
-
- public function testIsAppStoreEnabledSuccess() {
- $this->config
- ->expects($this->once())
- ->method('getSystemValue')
- ->with('appstoreenabled', true)
- ->will($this->returnValue(true));
- $this->assertTrue($this->ocsClient->isAppStoreEnabled());
- }
-
- public function testIsAppStoreEnabledFail() {
- $this->config
- ->expects($this->once())
- ->method('getSystemValue')
- ->with('appstoreenabled', true)
- ->will($this->returnValue(false));
- $this->assertFalse($this->ocsClient->isAppStoreEnabled());
- }
-
- public function testGetAppStoreUrl() {
- $this->config
- ->expects($this->once())
- ->method('getSystemValue')
- ->with('appstoreurl', 'https://api.owncloud.com/v1')
- ->will($this->returnValue('https://api.owncloud.com/v1'));
- $this->assertSame('https://api.owncloud.com/v1', self::invokePrivate($this->ocsClient, 'getAppStoreUrl'));
- }
-
- public function testGetCategoriesDisabledAppStore() {
- $this->config
- ->expects($this->once())
- ->method('getSystemValue')
- ->with('appstoreenabled', true)
- ->will($this->returnValue(false));
- $this->assertNull($this->ocsClient->getCategories([8, 1, 0, 7]));
- }
-
- public function testGetCategoriesExceptionClient() {
- $this->config
- ->expects($this->at(0))
- ->method('getSystemValue')
- ->with('appstoreenabled', true)
- ->will($this->returnValue(true));
- $this->config
- ->expects($this->at(1))
- ->method('getSystemValue')
- ->with('appstoreurl', 'https://api.owncloud.com/v1')
- ->will($this->returnValue('https://api.owncloud.com/v1'));
-
- $client = $this->createMock(IClient::class);
- $client
- ->expects($this->once())
- ->method('get')
- ->with(
- 'https://api.owncloud.com/v1/content/categories',
- [
- 'timeout' => 20,
- 'query' => ['version' => '8x1x0x7'],
- ]
- )
- ->will($this->throwException(new \Exception('TheErrorMessage')));
-
- $this->clientService
- ->expects($this->once())
- ->method('newClient')
- ->will($this->returnValue($client));
-
- $this->logger
- ->expects($this->once())
- ->method('error')
- ->with(
- 'Could not get categories: TheErrorMessage',
- [
- 'app' => 'core',
- ]
- );
-
- $this->assertNull($this->ocsClient->getCategories([8, 1, 0, 7]));
- }
-
- public function testGetCategoriesParseError() {
- $this->config
- ->expects($this->at(0))
- ->method('getSystemValue')
- ->with('appstoreenabled', true)
- ->will($this->returnValue(true));
- $this->config
- ->expects($this->at(1))
- ->method('getSystemValue')
- ->with('appstoreurl', 'https://api.owncloud.com/v1')
- ->will($this->returnValue('https://api.owncloud.com/v1'));
-
- $response = $this->createMock(IResponse::class);
- $response
- ->expects($this->once())
- ->method('getBody')
- ->will($this->returnValue('MyInvalidXml'));
-
- $client = $this->createMock(IClient::class);
- $client
- ->expects($this->once())
- ->method('get')
- ->with(
- 'https://api.owncloud.com/v1/content/categories',
- [
- 'timeout' => 20,
- 'query' => ['version' => '8x1x0x7'],
- ]
- )
- ->will($this->returnValue($response));
-
- $this->clientService
- ->expects($this->once())
- ->method('newClient')
- ->will($this->returnValue($client));
-
- $this->logger
- ->expects($this->once())
- ->method('error')
- ->with(
- 'Could not get categories, content was no valid XML',
- [
- 'app' => 'core',
- ]
- );
-
- $this->assertNull($this->ocsClient->getCategories([8, 1, 0, 7]));
- }
-
- public function testGetCategoriesSuccessful() {
- $this->config
- ->expects($this->at(0))
- ->method('getSystemValue')
- ->with('appstoreenabled', true)
- ->will($this->returnValue(true));
- $this->config
- ->expects($this->at(1))
- ->method('getSystemValue')
- ->with('appstoreurl', 'https://api.owncloud.com/v1')
- ->will($this->returnValue('https://api.owncloud.com/v1'));
-
- $response = $this->createMock(IResponse::class);
- $response
- ->expects($this->once())
- ->method('getBody')
- ->will($this->returnValue('<?xml version="1.0"?>
- <ocs>
- <meta>
- <status>ok</status>
- <statuscode>100</statuscode>
- <message></message>
- <totalitems>6</totalitems>
- </meta>
- <data>
- <category>
- <id>920</id>
- <name>ownCloud Multimedia</name>
- </category>
- <category>
- <id>921</id>
- <name>ownCloud PIM</name>
- </category>
- <category>
- <id>922</id>
- <name>ownCloud Productivity</name>
- </category>
- <category>
- <id>923</id>
- <name>ownCloud Game</name>
- </category>
- <category>
- <id>924</id>
- <name>ownCloud Tool</name>
- </category>
- <category>
- <id>925</id>
- <name>ownCloud other</name>
- </category>
- </data>
- </ocs>
- '));
-
- $client = $this->createMock(IClient::class);
- $client
- ->expects($this->once())
- ->method('get')
- ->with(
- 'https://api.owncloud.com/v1/content/categories',
- [
- 'timeout' => 20,
- 'query' => ['version' => '8x1x0x7'],
- ]
- )
- ->will($this->returnValue($response));
-
- $this->clientService
- ->expects($this->once())
- ->method('newClient')
- ->will($this->returnValue($client));
-
- $expected = [
- 920 => 'ownCloud Multimedia',
- 921 => 'ownCloud PIM',
- 922 => 'ownCloud Productivity',
- 923 => 'ownCloud Game',
- 924 => 'ownCloud Tool',
- 925 => 'ownCloud other',
- ];
- $this->assertSame($expected, $this->ocsClient->getCategories([8, 1, 0, 7]));
- }
-
- public function testGetApplicationsDisabledAppStore() {
- $this->config
- ->expects($this->once())
- ->method('getSystemValue')
- ->with('appstoreenabled', true)
- ->will($this->returnValue(false));
- $this->assertSame([], $this->ocsClient->getApplications([], 1, 'approved', [8, 1, 0, 7]));
- }
-
- public function testGetApplicationsExceptionClient() {
- $this->config
- ->expects($this->at(0))
- ->method('getSystemValue')
- ->with('appstoreenabled', true)
- ->will($this->returnValue(true));
- $this->config
- ->expects($this->at(1))
- ->method('getSystemValue')
- ->with('appstoreurl', 'https://api.owncloud.com/v1')
- ->will($this->returnValue('https://api.owncloud.com/v1'));
-
- $client = $this->createMock(IClient::class);
- $client
- ->expects($this->once())
- ->method('get')
- ->with(
- 'https://api.owncloud.com/v1/content/data',
- [
- 'timeout' => 20,
- 'query' => [
- 'version' => implode('x', [8, 1, 0, 7]),
- 'filter' => 'approved',
- 'categories' => '815x1337',
- 'sortmode' => 'new',
- 'page' => 1,
- 'pagesize' => 100,
- 'approved' => 'approved',
- ],
- ]
- )
- ->will($this->throwException(new \Exception('TheErrorMessage')));
-
- $this->clientService
- ->expects($this->once())
- ->method('newClient')
- ->will($this->returnValue($client));
-
- $this->logger
- ->expects($this->once())
- ->method('error')
- ->with(
- 'Could not get applications: TheErrorMessage',
- [
- 'app' => 'core',
- ]
- );
-
- $this->assertSame([], $this->ocsClient->getApplications([815, 1337], 1, 'approved', [8, 1, 0, 7]));
- }
-
- public function testGetApplicationsParseError() {
- $this->config
- ->expects($this->at(0))
- ->method('getSystemValue')
- ->with('appstoreenabled', true)
- ->will($this->returnValue(true));
- $this->config
- ->expects($this->at(1))
- ->method('getSystemValue')
- ->with('appstoreurl', 'https://api.owncloud.com/v1')
- ->will($this->returnValue('https://api.owncloud.com/v1'));
-
- $response = $this->createMock(IResponse::class);
- $response
- ->expects($this->once())
- ->method('getBody')
- ->will($this->returnValue('MyInvalidXml'));
-
- $client = $this->createMock(IClient::class);
- $client
- ->expects($this->once())
- ->method('get')
- ->with(
- 'https://api.owncloud.com/v1/content/data',
- [
- 'timeout' => 20,
- 'query' => [
- 'version' => implode('x', [8, 1, 0, 7]),
- 'filter' => 'approved',
- 'categories' => '815x1337',
- 'sortmode' => 'new',
- 'page' => 1,
- 'pagesize' => 100,
- 'approved' => 'approved',
- ],
- ]
- )
- ->will($this->returnValue($response));
-
- $this->clientService
- ->expects($this->once())
- ->method('newClient')
- ->will($this->returnValue($client));
-
- $this->logger
- ->expects($this->once())
- ->method('error')
- ->with(
- 'Could not get applications, content was no valid XML',
- [
- 'app' => 'core',
- ]
- );
-
- $this->assertSame([], $this->ocsClient->getApplications([815, 1337], 1, 'approved', [8, 1, 0, 7]));
- }
-
- public function testGetApplicationsSuccessful() {
- $this->config
- ->expects($this->at(0))
- ->method('getSystemValue')
- ->with('appstoreenabled', true)
- ->will($this->returnValue(true));
- $this->config
- ->expects($this->at(1))
- ->method('getSystemValue')
- ->with('appstoreurl', 'https://api.owncloud.com/v1')
- ->will($this->returnValue('https://api.owncloud.com/v1'));
-
- $response = $this->createMock(IResponse::class);
- $response
- ->expects($this->once())
- ->method('getBody')
- ->will($this->returnValue('<?xml version="1.0"?>
- <ocs>
- <meta>
- <status>ok</status>
- <statuscode>100</statuscode>
- <message></message>
- <totalitems>2</totalitems>
- <itemsperpage>100</itemsperpage>
- </meta>
- <data>
- <content details="summary">
- <id>168707</id>
- <name>Calendar 8.0</name>
- <version>0.6.4</version>
- <label>recommended</label>
- <changed>2015-02-09T15:23:56+01:00</changed>
- <created>2015-01-26T04:35:19+01:00</created>
- <typeid>921</typeid>
- <typename>ownCloud PIM</typename>
- <language></language>
- <personid>owncloud</personid>
- <profilepage>http://opendesktop.org/usermanager/search.php?username=owncloud</profilepage>
- <downloads>5393</downloads>
- <score>60</score>
- <description>Calendar App for ownCloud</description>
- <comments>7</comments>
- <fans>10</fans>
- <licensetype>16</licensetype>
- <approved>0</approved>
- <category>1</category>
- <license>AGPL</license>
- <preview1></preview1>
- <detailpage>https://apps.owncloud.com/content/show.php?content=168707</detailpage>
- <downloadtype1></downloadtype1>
- <downloadway1>0</downloadway1>
- <downloadprice1>0</downloadprice1>
- <downloadlink1>http://apps.owncloud.com/content/download.php?content=168707&amp;id=1</downloadlink1>
- <downloadgpgsignature1></downloadgpgsignature1>
- <downloadgpgfingerprint1></downloadgpgfingerprint1>
- <downloadpackagename1></downloadpackagename1>
- <downloadrepository1></downloadrepository1>
- <downloadname1></downloadname1>
- <downloadsize1>885</downloadsize1>
- </content>
- <content details="summary">
- <id>168708</id>
- <name>Contacts 8.0</name>
- <version>0.3.0.18</version>
- <label>recommended</label>
- <changed>2015-02-09T15:18:58+01:00</changed>
- <created>2015-01-26T04:45:17+01:00</created>
- <typeid>921</typeid>
- <typename>ownCloud PIM</typename>
- <language></language>
- <personid>owncloud</personid>
- <profilepage>http://opendesktop.org/usermanager/search.php?username=owncloud</profilepage>
- <downloads>4237</downloads>
- <score>58</score>
- <description></description>
- <comments>3</comments>
- <fans>6</fans>
- <licensetype>16</licensetype>
- <approved>200</approved>
- <category>1</category>
- <license>AGPL</license>
- <preview1></preview1>
- <detailpage>https://apps.owncloud.com/content/show.php?content=168708</detailpage>
- <downloadtype1></downloadtype1>
- <downloadway1>0</downloadway1>
- <downloadprice1>0</downloadprice1>
- <downloadlink1>http://apps.owncloud.com/content/download.php?content=168708&amp;id=1</downloadlink1>
- <downloadgpgsignature1></downloadgpgsignature1>
- <downloadgpgfingerprint1></downloadgpgfingerprint1>
- <downloadpackagename1></downloadpackagename1>
- <downloadrepository1></downloadrepository1>
- <downloadname1></downloadname1>
- <downloadsize1>1409</downloadsize1>
- </content>
- </data>
- </ocs> '));
-
- $client = $this->createMock(IClient::class);
- $client
- ->expects($this->once())
- ->method('get')
- ->with(
- 'https://api.owncloud.com/v1/content/data',
- [
- 'timeout' => 20,
- 'query' => [
- 'version' => implode('x', [8, 1, 0, 7]),
- 'filter' => 'approved',
- 'categories' => '815x1337',
- 'sortmode' => 'new',
- 'page' => 1,
- 'pagesize' => 100,
- 'approved' => 'approved',
- ],
- ]
- )
- ->will($this->returnValue($response));
-
- $this->clientService
- ->expects($this->once())
- ->method('newClient')
- ->will($this->returnValue($client));
-
- $expected = [
- [
- 'id' => '168707',
- 'name' => 'Calendar 8.0',
- 'label' => 'recommended',
- 'version' => '0.6.4',
- 'type' => '921',
- 'typename' => 'ownCloud PIM',
- 'personid' => 'owncloud',
- 'license' => 'AGPL',
- 'detailpage' => 'https://apps.owncloud.com/content/show.php?content=168707',
- 'preview' => '',
- 'preview-full' => '',
- 'changed' => 1423491836,
- 'description' => 'Calendar App for ownCloud',
- 'score' => '60',
- 'downloads' => 5393,
- 'level' => 0,
- 'profilepage' => 'http://opendesktop.org/usermanager/search.php?username=owncloud',
- ],
- [
- 'id' => '168708',
- 'name' => 'Contacts 8.0',
- 'label' => 'recommended',
- 'version' => '0.3.0.18',
- 'type' => '921',
- 'typename' => 'ownCloud PIM',
- 'personid' => 'owncloud',
- 'license' => 'AGPL',
- 'detailpage' => 'https://apps.owncloud.com/content/show.php?content=168708',
- 'preview' => '',
- 'preview-full' => '',
- 'changed' => 1423491538,
- 'description' => '',
- 'score' => '58',
- 'downloads' => 4237,
- 'level' => 200,
- 'profilepage' => 'http://opendesktop.org/usermanager/search.php?username=owncloud',
- ],
- ];
- $this->assertEquals($expected, $this->ocsClient->getApplications([815, 1337], 1, 'approved', [8, 1, 0, 7]));
- }
-
- public function tesGetApplicationDisabledAppStore() {
- $this->config
- ->expects($this->once())
- ->method('getSystemValue')
- ->with('appstoreenabled', true)
- ->will($this->returnValue(false));
- $this->assertNull($this->ocsClient->getApplication('MyId', [8, 1, 0, 7]));
- }
-
- public function testGetApplicationExceptionClient() {
- $this->config
- ->expects($this->at(0))
- ->method('getSystemValue')
- ->with('appstoreenabled', true)
- ->will($this->returnValue(true));
- $this->config
- ->expects($this->at(1))
- ->method('getSystemValue')
- ->with('appstoreurl', 'https://api.owncloud.com/v1')
- ->will($this->returnValue('https://api.owncloud.com/v1'));
-
- $client = $this->createMock(IClient::class);
- $client
- ->expects($this->once())
- ->method('get')
- ->with(
- 'https://api.owncloud.com/v1/content/data/MyId',
- [
- 'timeout' => 20,
- 'query' => ['version' => '8x1x0x7'],
- ]
- )
- ->will($this->throwException(new \Exception('TheErrorMessage')));
-
- $this->clientService
- ->expects($this->once())
- ->method('newClient')
- ->will($this->returnValue($client));
-
- $this->logger
- ->expects($this->once())
- ->method('error')
- ->with(
- 'Could not get application: TheErrorMessage',
- [
- 'app' => 'core',
- ]
- );
-
- $this->assertNull($this->ocsClient->getApplication('MyId', [8, 1, 0, 7]));
- }
-
- public function testGetApplicationParseError() {
- $this->config
- ->expects($this->at(0))
- ->method('getSystemValue')
- ->with('appstoreenabled', true)
- ->will($this->returnValue(true));
- $this->config
- ->expects($this->at(1))
- ->method('getSystemValue')
- ->with('appstoreurl', 'https://api.owncloud.com/v1')
- ->will($this->returnValue('https://api.owncloud.com/v1'));
-
- $response = $this->createMock(IResponse::class);
- $response
- ->expects($this->once())
- ->method('getBody')
- ->will($this->returnValue('MyInvalidXml'));
-
- $client = $this->createMock(IClient::class);
- $client
- ->expects($this->once())
- ->method('get')
- ->with(
- 'https://api.owncloud.com/v1/content/data/MyId',
- [
- 'timeout' => 20,
- 'query' => ['version' => '8x1x0x7'],
- ]
- )
- ->will($this->returnValue($response));
-
- $this->clientService
- ->expects($this->once())
- ->method('newClient')
- ->will($this->returnValue($client));
-
- $this->logger
- ->expects($this->once())
- ->method('error')
- ->with(
- 'Could not get application, content was no valid XML',
- [
- 'app' => 'core',
- ]
- );
-
- $this->assertNull($this->ocsClient->getApplication('MyId', [8, 1, 0, 7]));
- }
-
- public function testGetApplicationSuccessful() {
- $this->config
- ->expects($this->at(0))
- ->method('getSystemValue')
- ->with('appstoreenabled', true)
- ->will($this->returnValue(true));
- $this->config
- ->expects($this->at(1))
- ->method('getSystemValue')
- ->with('appstoreurl', 'https://api.owncloud.com/v1')
- ->will($this->returnValue('https://api.owncloud.com/v1'));
-
- $response = $this->createMock(IResponse::class);
- $response
- ->expects($this->once())
- ->method('getBody')
- ->will($this->returnValue('<?xml version="1.0"?>
- <ocs>
- <meta>
- <status>ok</status>
- <statuscode>100</statuscode>
- <message></message>
- </meta>
- <data>
- <content details="full">
- <id>166053</id>
- <name>Versioning</name>
- <version>0.0.1</version>
- <label>recommended</label>
- <typeid>925</typeid>
- <typename>ownCloud other</typename>
- <language></language>
- <personid>owncloud</personid>
- <profilepage>http://opendesktop.org/usermanager/search.php?username=owncloud</profilepage>
- <created>2014-07-07T16:34:40+02:00</created>
- <changed>2014-07-07T16:34:40+02:00</changed>
- <downloads>140</downloads>
- <score>50</score>
- <description>Placeholder for future updates</description>
- <summary></summary>
- <feedbackurl></feedbackurl>
- <changelog></changelog>
- <homepage></homepage>
- <homepagetype></homepagetype>
- <homepage2></homepage2>
- <homepagetype2></homepagetype2>
- <homepage3></homepage3>
- <homepagetype3></homepagetype3>
- <homepage4></homepage4>
- <homepagetype4></homepagetype4>
- <homepage5></homepage5>
- <homepagetype5></homepagetype5>
- <homepage6></homepage6>
- <homepagetype6></homepagetype6>
- <homepage7></homepage7>
- <homepagetype7></homepagetype7>
- <homepage8></homepage8>
- <homepagetype8></homepagetype8>
- <homepage9></homepage9>
- <homepagetype9></homepagetype9>
- <homepage10></homepage10>
- <homepagetype10></homepagetype10>
- <licensetype>16</licensetype>
- <license>AGPL</license>
- <donationpage></donationpage>
- <comments>0</comments>
- <commentspage>http://apps.owncloud.com/content/show.php?content=166053</commentspage>
- <fans>0</fans>
- <fanspage>http://apps.owncloud.com/content/show.php?action=fan&amp;content=166053</fanspage>
- <knowledgebaseentries>0</knowledgebaseentries>
- <knowledgebasepage>http://apps.owncloud.com/content/show.php?action=knowledgebase&amp;content=166053</knowledgebasepage>
- <depend>ownCloud 7</depend>
- <preview1></preview1>
- <preview2></preview2>
- <preview3></preview3>
- <previewpic1></previewpic1>
- <previewpic2></previewpic2>
- <previewpic3></previewpic3>
- <picsmall1></picsmall1>
- <picsmall2></picsmall2>
- <picsmall3></picsmall3>
- <detailpage>https://apps.owncloud.com/content/show.php?content=166053</detailpage>
- <downloadtype1></downloadtype1>
- <downloadprice1>0</downloadprice1>
- <downloadlink1>http://apps.owncloud.com/content/download.php?content=166053&amp;id=1</downloadlink1>
- <downloadname1></downloadname1>
- <downloadgpgfingerprint1></downloadgpgfingerprint1>
- <downloadgpgsignature1></downloadgpgsignature1>
- <downloadpackagename1></downloadpackagename1>
- <downloadrepository1></downloadrepository1>
- <downloadsize1>1</downloadsize1>
- <approved>200</approved>
- </content>
- </data>
- </ocs>
- '));
-
- $client = $this->createMock(IClient::class);
- $client
- ->expects($this->once())
- ->method('get')
- ->with(
- 'https://api.owncloud.com/v1/content/data/166053',
- [
- 'timeout' => 20,
- 'query' => ['version' => '8x1x0x7'],
- ]
- )
- ->will($this->returnValue($response));
-
- $this->clientService
- ->expects($this->once())
- ->method('newClient')
- ->will($this->returnValue($client));
-
- $expected = [
- 'id' => 166053,
- 'name' => 'Versioning',
- 'version' => '0.0.1',
- 'type' => '925',
- 'label' => 'recommended',
- 'typename' => 'ownCloud other',
- 'personid' => 'owncloud',
- 'profilepage' => 'http://opendesktop.org/usermanager/search.php?username=owncloud',
- 'detailpage' => 'https://apps.owncloud.com/content/show.php?content=166053',
- 'preview1' => '',
- 'preview2' => '',
- 'preview3' => '',
- 'changed' => 1404743680,
- 'description' => 'Placeholder for future updates',
- 'score' => 50,
- 'level' => 200,
- ];
- $this->assertSame($expected, $this->ocsClient->getApplication(166053, [8, 1, 0, 7]));
- }
-
- public function testGetApplicationSuccessfulWithOldId() {
- $this->config
- ->expects($this->at(0))
- ->method('getSystemValue')
- ->with('appstoreenabled', true)
- ->will($this->returnValue(true));
- $this->config
- ->expects($this->at(1))
- ->method('getSystemValue')
- ->with('appstoreurl', 'https://api.owncloud.com/v1')
- ->will($this->returnValue('https://api.owncloud.com/v1'));
-
- $response = $this->createMock(IResponse::class);
- $response
- ->expects($this->once())
- ->method('getBody')
- ->will($this->returnValue('<?xml version="1.0"?>
- <ocs>
- <meta>
- <status>ok</status>
- <statuscode>100</statuscode>
- <message></message>
- </meta>
- <data>
- <content details="full">
- <id>1337</id>
- <name>Versioning</name>
- <version>0.0.1</version>
- <label>recommended</label>
- <typeid>925</typeid>
- <typename>ownCloud other</typename>
- <language></language>
- <personid>owncloud</personid>
- <profilepage>http://opendesktop.org/usermanager/search.php?username=owncloud</profilepage>
- <created>2014-07-07T16:34:40+02:00</created>
- <changed>2014-07-07T16:34:40+02:00</changed>
- <downloads>140</downloads>
- <score>50</score>
- <description>Placeholder for future updates</description>
- <summary></summary>
- <feedbackurl></feedbackurl>
- <changelog></changelog>
- <homepage></homepage>
- <homepagetype></homepagetype>
- <homepage2></homepage2>
- <homepagetype2></homepagetype2>
- <homepage3></homepage3>
- <homepagetype3></homepagetype3>
- <homepage4></homepage4>
- <homepagetype4></homepagetype4>
- <homepage5></homepage5>
- <homepagetype5></homepagetype5>
- <homepage6></homepage6>
- <homepagetype6></homepagetype6>
- <homepage7></homepage7>
- <homepagetype7></homepagetype7>
- <homepage8></homepage8>
- <homepagetype8></homepagetype8>
- <homepage9></homepage9>
- <homepagetype9></homepagetype9>
- <homepage10></homepage10>
- <homepagetype10></homepagetype10>
- <licensetype>16</licensetype>
- <license>AGPL</license>
- <donationpage></donationpage>
- <comments>0</comments>
- <commentspage>http://apps.owncloud.com/content/show.php?content=166053</commentspage>
- <fans>0</fans>
- <fanspage>http://apps.owncloud.com/content/show.php?action=fan&amp;content=166053</fanspage>
- <knowledgebaseentries>0</knowledgebaseentries>
- <knowledgebasepage>http://apps.owncloud.com/content/show.php?action=knowledgebase&amp;content=166053</knowledgebasepage>
- <depend>ownCloud 7</depend>
- <preview1></preview1>
- <preview2></preview2>
- <preview3></preview3>
- <previewpic1></previewpic1>
- <previewpic2></previewpic2>
- <previewpic3></previewpic3>
- <picsmall1></picsmall1>
- <picsmall2></picsmall2>
- <picsmall3></picsmall3>
- <detailpage>https://apps.owncloud.com/content/show.php?content=166053</detailpage>
- <downloadtype1></downloadtype1>
- <downloadprice1>0</downloadprice1>
- <downloadlink1>http://apps.owncloud.com/content/download.php?content=166053&amp;id=1</downloadlink1>
- <downloadname1></downloadname1>
- <downloadgpgfingerprint1></downloadgpgfingerprint1>
- <downloadgpgsignature1></downloadgpgsignature1>
- <downloadpackagename1></downloadpackagename1>
- <downloadrepository1></downloadrepository1>
- <downloadsize1>1</downloadsize1>
- <approved>200</approved>
- </content>
- </data>
- </ocs>
- '));
-
- $client = $this->createMock(IClient::class);
- $client
- ->expects($this->once())
- ->method('get')
- ->with(
- 'https://api.owncloud.com/v1/content/data/166053',
- [
- 'timeout' => 20,
- 'query' => ['version' => '8x1x0x7'],
- ]
- )
- ->will($this->returnValue($response));
-
- $this->clientService
- ->expects($this->once())
- ->method('newClient')
- ->will($this->returnValue($client));
-
- $expected = [
- 'id' => 166053,
- 'name' => 'Versioning',
- 'version' => '0.0.1',
- 'type' => '925',
- 'label' => 'recommended',
- 'typename' => 'ownCloud other',
- 'personid' => 'owncloud',
- 'profilepage' => 'http://opendesktop.org/usermanager/search.php?username=owncloud',
- 'detailpage' => 'https://apps.owncloud.com/content/show.php?content=166053',
- 'preview1' => '',
- 'preview2' => '',
- 'preview3' => '',
- 'changed' => 1404743680,
- 'description' => 'Placeholder for future updates',
- 'score' => 50,
- 'level' => 200,
- ];
- $this->assertSame($expected, $this->ocsClient->getApplication(166053, [8, 1, 0, 7]));
- }
-
- public function testGetApplicationEmptyXml() {
- $this->config
- ->expects($this->at(0))
- ->method('getSystemValue')
- ->with('appstoreenabled', true)
- ->will($this->returnValue(true));
- $this->config
- ->expects($this->at(1))
- ->method('getSystemValue')
- ->with('appstoreurl', 'https://api.owncloud.com/v1')
- ->will($this->returnValue('https://api.owncloud.com/v1'));
-
- $response = $this->createMock(IResponse::class);
- $response
- ->expects($this->once())
- ->method('getBody')
- ->will($this->returnValue('<?xml version="1.0"?>
- <ocs>
- <meta>
- <status>ok</status>
- <statuscode>100</statuscode>
- <message></message>
- </meta>
- </ocs>
- '));
-
- $client = $this->createMock(IClient::class);
- $client
- ->expects($this->once())
- ->method('get')
- ->with(
- 'https://api.owncloud.com/v1/content/data/MyId',
- [
- 'timeout' => 20,
- 'query' => ['version' => '8x1x0x7'],
- ]
- )
- ->will($this->returnValue($response));
-
- $this->clientService
- ->expects($this->once())
- ->method('newClient')
- ->will($this->returnValue($client));
-
- $this->assertSame(null, $this->ocsClient->getApplication('MyId', [8, 1, 0, 7]));
- }
-
- public function testGetApplicationDownloadDisabledAppStore() {
- $this->config
- ->expects($this->once())
- ->method('getSystemValue')
- ->with('appstoreenabled', true)
- ->will($this->returnValue(false));
- $this->assertNull($this->ocsClient->getApplicationDownload('MyId', [8, 1, 0, 7]));
- }
-
- public function testGetApplicationDownloadExceptionClient() {
- $this->config
- ->expects($this->at(0))
- ->method('getSystemValue')
- ->with('appstoreenabled', true)
- ->will($this->returnValue(true));
- $this->config
- ->expects($this->at(1))
- ->method('getSystemValue')
- ->with('appstoreurl', 'https://api.owncloud.com/v1')
- ->will($this->returnValue('https://api.owncloud.com/v1'));
-
- $client = $this->createMock(IClient::class);
- $client
- ->expects($this->once())
- ->method('get')
- ->with(
- 'https://api.owncloud.com/v1/content/download/MyId/1',
- [
- 'timeout' => 20,
- 'query' => ['version' => '8x1x0x7'],
- ]
- )
- ->will($this->throwException(new \Exception('TheErrorMessage')));
-
- $this->clientService
- ->expects($this->once())
- ->method('newClient')
- ->will($this->returnValue($client));
-
- $this->logger
- ->expects($this->once())
- ->method('error')
- ->with(
- 'Could not get application download URL: TheErrorMessage',
- [
- 'app' => 'core',
- ]
- );
-
- $this->assertNull($this->ocsClient->getApplicationDownload('MyId', [8, 1, 0, 7]));
- }
-
- public function testGetApplicationDownloadParseError() {
- $this->config
- ->expects($this->at(0))
- ->method('getSystemValue')
- ->with('appstoreenabled', true)
- ->will($this->returnValue(true));
- $this->config
- ->expects($this->at(1))
- ->method('getSystemValue')
- ->with('appstoreurl', 'https://api.owncloud.com/v1')
- ->will($this->returnValue('https://api.owncloud.com/v1'));
-
- $response = $this->createMock(IResponse::class);
- $response
- ->expects($this->once())
- ->method('getBody')
- ->will($this->returnValue('MyInvalidXml'));
-
- $client = $this->createMock(IClient::class);
- $client
- ->expects($this->once())
- ->method('get')
- ->with(
- 'https://api.owncloud.com/v1/content/download/MyId/1',
- [
- 'timeout' => 20,
- 'query' => ['version' => '8x1x0x7'],
- ]
- )
- ->will($this->returnValue($response));
-
- $this->clientService
- ->expects($this->once())
- ->method('newClient')
- ->will($this->returnValue($client));
-
- $this->logger
- ->expects($this->once())
- ->method('error')
- ->with(
- 'Could not get application download URL, content was no valid XML',
- [
- 'app' => 'core',
- ]
- );
-
- $this->assertNull($this->ocsClient->getApplicationDownload('MyId', [8, 1, 0, 7]));
- }
-
- public function testGetApplicationDownloadUrlSuccessful() {
- $this->config
- ->expects($this->at(0))
- ->method('getSystemValue')
- ->with('appstoreenabled', true)
- ->will($this->returnValue(true));
- $this->config
- ->expects($this->at(1))
- ->method('getSystemValue')
- ->with('appstoreurl', 'https://api.owncloud.com/v1')
- ->will($this->returnValue('https://api.owncloud.com/v1'));
-
- $response = $this->createMock(IResponse::class);
- $response
- ->expects($this->once())
- ->method('getBody')
- ->will($this->returnValue('<?xml version="1.0"?>
- <ocs>
- <meta>
- <status>ok</status>
- <statuscode>100</statuscode>
- <message></message>
- </meta>
- <data>
- <content details="download">
- <downloadlink>https://apps.owncloud.com/CONTENT/content-files/166052-files_trashbin.zip</downloadlink>
- <mimetype>application/zip</mimetype>
- <gpgfingerprint></gpgfingerprint>
- <gpgsignature></gpgsignature>
- <packagename></packagename>
- <repository></repository>
- </content>
- </data>
- </ocs>
- '));
-
- $client = $this->createMock(IClient::class);
- $client
- ->expects($this->once())
- ->method('get')
- ->with(
- 'https://api.owncloud.com/v1/content/download/MyId/1',
- [
- 'timeout' => 20,
- 'query' => ['version' => '8x1x0x7'],
- ]
- )
- ->will($this->returnValue($response));
-
- $this->clientService
- ->expects($this->once())
- ->method('newClient')
- ->will($this->returnValue($client));
-
- $expected = [
- 'downloadlink' => 'https://apps.owncloud.com/CONTENT/content-files/166052-files_trashbin.zip',
- ];
- $this->assertSame($expected, $this->ocsClient->getApplicationDownload('MyId', [8, 1, 0, 7]));
- }
-}
diff --git a/tests/lib/ServerTest.php b/tests/lib/ServerTest.php
index 2e5900c4ce5..3ff8787b91a 100644
--- a/tests/lib/ServerTest.php
+++ b/tests/lib/ServerTest.php
@@ -122,8 +122,6 @@ class ServerTest extends \Test\TestCase {
['UserCache', '\OC\Cache\File'],
['UserCache', '\OCP\ICache'],
- ['OcsClient', '\OC\OCSClient'],
-
['PreviewManager', '\OC\PreviewManager'],
['PreviewManager', '\OCP\IPreview'],