]> source.dussan.org Git - nextcloud-server.git/commitdiff
Add DB group to some files_external tests
authorThomas Müller <thomas.mueller@tmit.eu>
Wed, 25 Nov 2015 15:58:54 +0000 (16:58 +0100)
committerThomas Müller <thomas.mueller@tmit.eu>
Mon, 30 Nov 2015 09:55:10 +0000 (10:55 +0100)
Adding group Db to federation tests and ldap tests

Add group DB to Test_UrlGenerator

Adding group DB to trashbin and versions tests

Adding group DB to Test_Util_CheckServer for pg

21 files changed:
apps/federation/tests/backgroundjob/getsharedsecrettest.php
apps/files_external/tests/amazons3migration.php
apps/files_external/tests/etagpropagator.php
apps/files_external/tests/owncloudfunctions.php
apps/files_trashbin/tests/command/expiretest.php
apps/files_versions/tests/command/cleanuptest.php
apps/files_versions/tests/command/expiretest.php
apps/user_ldap/tests/access.php
apps/user_ldap/tests/connection.php
apps/user_ldap/tests/group_ldap.php
apps/user_ldap/tests/mapping/groupmapping.php
apps/user_ldap/tests/mapping/usermapping.php
apps/user_ldap/tests/user/manager.php
apps/user_ldap/tests/user/user.php
apps/user_ldap/tests/user_ldap.php
apps/user_ldap/tests/wizard.php
lib/private/files/storage/dav.php
lib/private/urlgenerator.php
tests/lib/urlGenerator.php [new file with mode: 0644]
tests/lib/urlgenerator.php [deleted file]
tests/lib/utilcheckserver.php

index 953af5ff3e103d2fd3c679dd39278e110e9598cc..cb3a294713a1149af30c5af792438853ab4382e2 100644 (file)
@@ -34,6 +34,13 @@ use OCP\Http\Client\IResponse;
 use OCP\ILogger;
 use OCP\IURLGenerator;
 
+/**
+ * Class GetSharedSecretTest
+ *
+ * @group DB
+ *
+ * @package OCA\Federation\Tests\BackgroundJob
+ */
 class GetSharedSecretTest extends TestCase {
 
        /** @var \PHPUnit_Framework_MockObject_MockObject | IClient */
index 3eba5bca644c09960d320ec6632cd0c793621628..33fb6119a92a346602472fbd4d687239475e4116 100644 (file)
 
 namespace Test\Files\Storage;
 
+/**
+ * Class AmazonS3Migration
+ *
+ * @group DB
+ *
+ * @package Test\Files\Storage
+ */
 class AmazonS3Migration extends \Test\TestCase {
 
        /**
index d45982cb40ca7233a6b7d96b7501f06a1f0a2c28..ff3c63add207bf9abeb762dcc515fb3611f0af47 100644 (file)
@@ -26,6 +26,13 @@ namespace Tests\Files_External;
 use OC\Files\Filesystem;
 use OC\User\User;
 
+/**
+ * Class EtagPropagator
+ *
+ * @group DB
+ *
+ * @package Tests\Files_External
+ */
 class EtagPropagator extends \Test\TestCase {
        protected function getUser() {
                return new User($this->getUniqueID(), null);
index 4cfe83db9505292ee761a50aa05c4f3f1d861b90..887dd91539b2312d953316a2b739dffbf7f96fd3 100644 (file)
 
 namespace Test\Files\Storage;
 
+/**
+ * Class OwnCloudFunctions
+ *
+ * @group DB
+ *
+ * @package Test\Files\Storage
+ */
 class OwnCloudFunctions extends \Test\TestCase {
 
        function configUrlProvider() {
index 0d457db280743872c821c8eb8927c7f471734df3..463fca6080ea88954ba62e26bff00f9bfa22b652 100644 (file)
@@ -24,6 +24,13 @@ namespace OCA\Files_Trashbin\Tests\Command;
 use OCA\Files_Trashbin\Command\Expire;
 use Test\TestCase;
 
+/**
+ * Class ExpireTest
+ *
+ * @group DB
+ *
+ * @package OCA\Files_Trashbin\Tests\Command
+ */
 class ExpireTest extends TestCase {
        public function testExpireNonExistingUser() {
                $command = new Expire('test');
index bfde25d75ce6dd786446ffb2de8af4775d1ae60b..141213774c08afbfcf80737bfd90ef7e43a94482 100644 (file)
@@ -28,6 +28,13 @@ use Test\TestCase;
 use OC\User\Manager;
 use OCP\Files\IRootFolder;
 
+/**
+ * Class CleanupTest
+ *
+ * @group DB
+ *
+ * @package OCA\Files_Versions\Tests\Command
+ */
 class CleanupTest extends TestCase {
 
        /** @var  CleanUp */
index eccc1f4c2ad5789bfc4fa5bd17a2eefb87e6e6b1..5048ab1ef31db62e98c140f350a13cbd273bc090 100644 (file)
@@ -25,6 +25,13 @@ namespace OCA\Files_Versions\Tests\Command;
 use OCA\Files_Versions\Command\Expire;
 use Test\TestCase;
 
+/**
+ * Class ExpireTest
+ *
+ * @group DB
+ *
+ * @package OCA\Files_Versions\Tests\Command
+ */
 class ExpireTest extends TestCase {
        public function testExpireNonExistingUser() {
                $command = new Expire($this->getUniqueID('test'), '');
index 25e871d9b3da89714e62fd723da25aa789a8296b..ef31a1037dd8970f4a42e841ae8e9207c6c624d5 100644 (file)
@@ -28,6 +28,13 @@ use \OCA\user_ldap\lib\Access;
 use \OCA\user_ldap\lib\Connection;
 use \OCA\user_ldap\lib\ILDAPWrapper;
 
+/**
+ * Class Test_Access
+ *
+ * @group DB
+ *
+ * @package OCA\user_ldap\tests
+ */
 class Test_Access extends \Test\TestCase {
        private function getConnectorAndLdapMock() {
                static $conMethods;
index b0b4b78ce4d275cad19705d720e31686fca754f0..10a299a61b19fc7de4f53e64a8790b1011c90659 100644 (file)
 
 namespace OCA\user_ldap\tests;
 
+/**
+ * Class Test_Connection
+ *
+ * @group DB
+ *
+ * @package OCA\user_ldap\tests
+ */
 class Test_Connection extends \Test\TestCase {
 
        public function testOriginalAgentUnchangedOnClone() {
@@ -52,4 +59,4 @@ class Test_Connection extends \Test\TestCase {
                $this->assertSame($agentPawd, $agent['ldapAgentPassword']);
        }
 
-}
\ No newline at end of file
+}
index 6a6d5bc7ca1e2c684d84bf1f20f621456dfe5fc0..5362b97f216e89ac3299889e932e5ea98634bd95 100644 (file)
@@ -30,6 +30,13 @@ use \OCA\user_ldap\lib\Access;
 use \OCA\user_ldap\lib\Connection;
 use \OCA\user_ldap\lib\ILDAPWrapper;
 
+/**
+ * Class Test_Group_Ldap
+ *
+ * @group DB
+ *
+ * @package OCA\user_ldap\tests
+ */
 class Test_Group_Ldap extends \Test\TestCase {
        private function getAccessMock() {
                static $conMethods;
index e8fe655630ddec229c15d0d2371bb018fe94317f..f9136cf529073ed2e7ea355cc2db159ce8f6125f 100644 (file)
@@ -24,6 +24,13 @@ namespace OCA\user_ldap\tests\mapping;
 
 use OCA\User_LDAP\Mapping\GroupMapping;
 
+/**
+ * Class Test_GroupMapping
+ *
+ * @group DB
+ *
+ * @package OCA\user_ldap\tests\mapping
+ */
 class Test_GroupMapping extends AbstractMappingTest {
        public function getMapper(\OCP\IDBConnection $dbMock) {
                return new GroupMapping($dbMock);
index fa9311b405a94a8891d48dca5289a05ba7744edb..e84f5020231d5eac75bbbdb8055b0f60c5e21110 100644 (file)
@@ -24,6 +24,13 @@ namespace OCA\user_ldap\tests\mapping;
 
 use OCA\User_LDAP\Mapping\UserMapping;
 
+/**
+ * Class Test_UserMapping
+ *
+ * @group DB
+ *
+ * @package OCA\user_ldap\tests\mapping
+ */
 class Test_UserMapping extends AbstractMappingTest {
        public function getMapper(\OCP\IDBConnection $dbMock) {
                return new UserMapping($dbMock);
index 98e48638d8b2d28cc534d67d7dbedb90959fa99e..d8602978a9d97d9f4616d1debcfedc232188cf17 100644 (file)
@@ -26,6 +26,13 @@ namespace OCA\user_ldap\tests;
 
 use OCA\user_ldap\lib\user\Manager;
 
+/**
+ * Class Test_User_Manager
+ *
+ * @group DB
+ *
+ * @package OCA\user_ldap\tests
+ */
 class Test_User_Manager extends \Test\TestCase {
 
        private function getTestInstances() {
index 19581d835d1f8769df8c9eb5a8136eb43af6a5f6..a5bb459d6fd9030addbf3e79e329598f297ceddf 100644 (file)
@@ -25,6 +25,13 @@ namespace OCA\user_ldap\tests;
 
 use OCA\user_ldap\lib\user\User;
 
+/**
+ * Class Test_User_User
+ *
+ * @group DB
+ *
+ * @package OCA\user_ldap\tests
+ */
 class Test_User_User extends \Test\TestCase {
 
        private function getTestInstances() {
index 0f70c43fc11f30218a3589263b2733d580718aeb..7593371d85d1c845428d2b05e9090b8e5c5f8461 100644 (file)
@@ -31,6 +31,13 @@ use \OCA\user_ldap\lib\Access;
 use \OCA\user_ldap\lib\Connection;
 use \OCA\user_ldap\lib\ILDAPWrapper;
 
+/**
+ * Class Test_User_Ldap_Direct
+ *
+ * @group DB
+ *
+ * @package OCA\user_ldap\tests
+ */
 class Test_User_Ldap_Direct extends \Test\TestCase {
        protected $backend;
        protected $access;
index 7b0461878315df601752e11c5a21390082637f86..c29361096a150d43618a207e354078fac998e285 100644 (file)
@@ -31,6 +31,13 @@ use \OCA\user_ldap\lib\Wizard;
 // use \OCA\user_ldap\lib\Configuration;
 // use \OCA\user_ldap\lib\ILDAPWrapper;
 
+/**
+ * Class Test_Wizard
+ *
+ * @group DB
+ *
+ * @package OCA\user_ldap\tests
+ */
 class Test_Wizard extends \Test\TestCase {
        protected function setUp() {
                parent::setUp();
index 9147f5724610eec20a56ee0e692f935d42dc36d8..dda163e41a0c961add8aecb5991d52584fe5f6d7 100644 (file)
@@ -105,6 +105,7 @@ class DAV extends Common {
                                $this->secure = false;
                        }
                        if ($this->secure === true) {
+                               // inject mock for testing
                                $certPath = \OC_User::getHome(\OC_User::getUser()) . '/files_external/rootcerts.crt';
                                if (file_exists($certPath)) {
                                        $this->certPath = $certPath;
index 104cf7df596d552b23c5c00388f2432eaba8e7ed..428a222f9c7dae9f8958a75bad13966f746677a9 100644 (file)
@@ -62,6 +62,7 @@ class URLGenerator implements IURLGenerator {
         * Returns a url to the given route.
         */
        public function linkToRoute($route, $parameters = array()) {
+               // TODO: mock router
                $urlLinkTo = \OC::$server->getRouter()->generate($route, $parameters);
                return $urlLinkTo;
        }
diff --git a/tests/lib/urlGenerator.php b/tests/lib/urlGenerator.php
new file mode 100644 (file)
index 0000000..0710322
--- /dev/null
@@ -0,0 +1,132 @@
+<?php
+/**
+ * Copyright (c) 2014 Bjoern Schiessle <schiessle@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+/**
+ * Class Test_UrlGenerator
+ *
+ * @group DB
+ */
+class Test_UrlGenerator extends \Test\TestCase {
+
+       /**
+        * @small
+        * test linkTo URL construction
+        * @dataProvider provideDocRootAppUrlParts
+        */
+       public function testLinkToDocRoot($app, $file, $args, $expectedResult) {
+               \OC::$WEBROOT = '';
+               $config = $this->getMock('\OCP\IConfig');
+               $cacheFactory = $this->getMock('\OCP\ICacheFactory');
+               $urlGenerator = new \OC\URLGenerator($config, $cacheFactory);
+               $result = $urlGenerator->linkTo($app, $file, $args);
+
+               $this->assertEquals($expectedResult, $result);
+       }
+
+       /**
+        * @small
+        * test linkTo URL construction in sub directory
+        * @dataProvider provideSubDirAppUrlParts
+        */
+       public function testLinkToSubDir($app, $file, $args, $expectedResult) {
+               \OC::$WEBROOT = '/owncloud';
+               $config = $this->getMock('\OCP\IConfig');
+               $cacheFactory = $this->getMock('\OCP\ICacheFactory');
+               $urlGenerator = new \OC\URLGenerator($config, $cacheFactory);
+               $result = $urlGenerator->linkTo($app, $file, $args);
+
+               $this->assertEquals($expectedResult, $result);
+       }
+
+       /**
+        * @dataProvider provideRoutes
+        */
+       public function testLinkToRouteAbsolute($route, $expected) {
+               \OC::$WEBROOT = '/owncloud';
+               $config = $this->getMock('\OCP\IConfig');
+               $cacheFactory = $this->getMock('\OCP\ICacheFactory');
+               $urlGenerator = new \OC\URLGenerator($config, $cacheFactory);
+               $result = $urlGenerator->linkToRouteAbsolute($route);
+               $this->assertEquals($expected, $result);
+
+       }
+
+       public function provideRoutes() {
+               return array(
+                       array('files_ajax_list', 'http://localhost/owncloud/index.php/apps/files/ajax/list.php'),
+                       array('core_ajax_preview', 'http://localhost/owncloud/index.php/core/preview.png'),
+               );
+       }
+
+       public function provideDocRootAppUrlParts() {
+               return array(
+                       array('files', 'ajax/list.php', array(), '/index.php/apps/files/ajax/list.php'),
+                       array('files', 'ajax/list.php', array('trut' => 'trat', 'dut' => 'dat'), '/index.php/apps/files/ajax/list.php?trut=trat&dut=dat'),
+                       array('', 'index.php', array('trut' => 'trat', 'dut' => 'dat'), '/index.php?trut=trat&dut=dat'),
+               );
+       }
+
+       public function provideSubDirAppUrlParts() {
+               return array(
+                       array('files', 'ajax/list.php', array(), '/owncloud/index.php/apps/files/ajax/list.php'),
+                       array('files', 'ajax/list.php', array('trut' => 'trat', 'dut' => 'dat'), '/owncloud/index.php/apps/files/ajax/list.php?trut=trat&dut=dat'),
+                       array('', 'index.php', array('trut' => 'trat', 'dut' => 'dat'), '/owncloud/index.php?trut=trat&dut=dat'),
+               );
+       }
+
+       /**
+        * @small
+        * test absolute URL construction
+        * @dataProvider provideDocRootURLs
+        */
+       function testGetAbsoluteURLDocRoot($url, $expectedResult) {
+
+               \OC::$WEBROOT = '';
+               $config = $this->getMock('\OCP\IConfig');
+               $cacheFactory = $this->getMock('\OCP\ICacheFactory');
+               $urlGenerator = new \OC\URLGenerator($config, $cacheFactory);
+               $result = $urlGenerator->getAbsoluteURL($url);
+
+               $this->assertEquals($expectedResult, $result);
+       }
+
+       /**
+        * @small
+        * test absolute URL construction
+        * @dataProvider provideSubDirURLs
+        */
+       function testGetAbsoluteURLSubDir($url, $expectedResult) {
+
+               \OC::$WEBROOT = '/owncloud';
+               $config = $this->getMock('\OCP\IConfig');
+               $cacheFactory = $this->getMock('\OCP\ICacheFactory');
+               $urlGenerator = new \OC\URLGenerator($config, $cacheFactory);
+               $result = $urlGenerator->getAbsoluteURL($url);
+
+               $this->assertEquals($expectedResult, $result);
+       }
+
+       public function provideDocRootURLs() {
+               return array(
+                       array("index.php", "http://localhost/index.php"),
+                       array("/index.php", "http://localhost/index.php"),
+                       array("/apps/index.php", "http://localhost/apps/index.php"),
+                       array("apps/index.php", "http://localhost/apps/index.php"),
+                       );
+       }
+
+       public function provideSubDirURLs() {
+               return array(
+                       array("index.php", "http://localhost/owncloud/index.php"),
+                       array("/index.php", "http://localhost/owncloud/index.php"),
+                       array("/apps/index.php", "http://localhost/owncloud/apps/index.php"),
+                       array("apps/index.php", "http://localhost/owncloud/apps/index.php"),
+                       );
+       }
+}
+
diff --git a/tests/lib/urlgenerator.php b/tests/lib/urlgenerator.php
deleted file mode 100644 (file)
index a5ab483..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-<?php
-/**
- * Copyright (c) 2014 Bjoern Schiessle <schiessle@owncloud.com>
- * This file is licensed under the Affero General Public License version 3 or
- * later.
- * See the COPYING-README file.
- */
-
-class Test_Urlgenerator extends \Test\TestCase {
-
-       /**
-        * @small
-        * test linkTo URL construction
-        * @dataProvider provideDocRootAppUrlParts
-        */
-       public function testLinkToDocRoot($app, $file, $args, $expectedResult) {
-               \OC::$WEBROOT = '';
-               $config = $this->getMock('\OCP\IConfig');
-               $cacheFactory = $this->getMock('\OCP\ICacheFactory');
-               $urlGenerator = new \OC\URLGenerator($config, $cacheFactory);
-               $result = $urlGenerator->linkTo($app, $file, $args);
-
-               $this->assertEquals($expectedResult, $result);
-       }
-
-       /**
-        * @small
-        * test linkTo URL construction in sub directory
-        * @dataProvider provideSubDirAppUrlParts
-        */
-       public function testLinkToSubDir($app, $file, $args, $expectedResult) {
-               \OC::$WEBROOT = '/owncloud';
-               $config = $this->getMock('\OCP\IConfig');
-               $cacheFactory = $this->getMock('\OCP\ICacheFactory');
-               $urlGenerator = new \OC\URLGenerator($config, $cacheFactory);
-               $result = $urlGenerator->linkTo($app, $file, $args);
-
-               $this->assertEquals($expectedResult, $result);
-       }
-
-       /**
-        * @dataProvider provideRoutes
-        */
-       public function testLinkToRouteAbsolute($route, $expected) {
-               \OC::$WEBROOT = '/owncloud';
-               $config = $this->getMock('\OCP\IConfig');
-               $cacheFactory = $this->getMock('\OCP\ICacheFactory');
-               $urlGenerator = new \OC\URLGenerator($config, $cacheFactory);
-               $result = $urlGenerator->linkToRouteAbsolute($route);
-               $this->assertEquals($expected, $result);
-
-       }
-
-       public function provideRoutes() {
-               return array(
-                       array('files_ajax_list', 'http://localhost/owncloud/index.php/apps/files/ajax/list.php'),
-                       array('core_ajax_preview', 'http://localhost/owncloud/index.php/core/preview.png'),
-               );
-       }
-
-       public function provideDocRootAppUrlParts() {
-               return array(
-                       array('files', 'ajax/list.php', array(), '/index.php/apps/files/ajax/list.php'),
-                       array('files', 'ajax/list.php', array('trut' => 'trat', 'dut' => 'dat'), '/index.php/apps/files/ajax/list.php?trut=trat&dut=dat'),
-                       array('', 'index.php', array('trut' => 'trat', 'dut' => 'dat'), '/index.php?trut=trat&dut=dat'),
-               );
-       }
-
-       public function provideSubDirAppUrlParts() {
-               return array(
-                       array('files', 'ajax/list.php', array(), '/owncloud/index.php/apps/files/ajax/list.php'),
-                       array('files', 'ajax/list.php', array('trut' => 'trat', 'dut' => 'dat'), '/owncloud/index.php/apps/files/ajax/list.php?trut=trat&dut=dat'),
-                       array('', 'index.php', array('trut' => 'trat', 'dut' => 'dat'), '/owncloud/index.php?trut=trat&dut=dat'),
-               );
-       }
-
-       /**
-        * @small
-        * test absolute URL construction
-        * @dataProvider provideDocRootURLs
-        */
-       function testGetAbsoluteURLDocRoot($url, $expectedResult) {
-
-               \OC::$WEBROOT = '';
-               $config = $this->getMock('\OCP\IConfig');
-               $cacheFactory = $this->getMock('\OCP\ICacheFactory');
-               $urlGenerator = new \OC\URLGenerator($config, $cacheFactory);
-               $result = $urlGenerator->getAbsoluteURL($url);
-
-               $this->assertEquals($expectedResult, $result);
-       }
-
-       /**
-        * @small
-        * test absolute URL construction
-        * @dataProvider provideSubDirURLs
-        */
-       function testGetAbsoluteURLSubDir($url, $expectedResult) {
-
-               \OC::$WEBROOT = '/owncloud';
-               $config = $this->getMock('\OCP\IConfig');
-               $cacheFactory = $this->getMock('\OCP\ICacheFactory');
-               $urlGenerator = new \OC\URLGenerator($config, $cacheFactory);
-               $result = $urlGenerator->getAbsoluteURL($url);
-
-               $this->assertEquals($expectedResult, $result);
-       }
-
-       public function provideDocRootURLs() {
-               return array(
-                       array("index.php", "http://localhost/index.php"),
-                       array("/index.php", "http://localhost/index.php"),
-                       array("/apps/index.php", "http://localhost/apps/index.php"),
-                       array("apps/index.php", "http://localhost/apps/index.php"),
-                       );
-       }
-
-       public function provideSubDirURLs() {
-               return array(
-                       array("index.php", "http://localhost/owncloud/index.php"),
-                       array("/index.php", "http://localhost/owncloud/index.php"),
-                       array("/apps/index.php", "http://localhost/owncloud/apps/index.php"),
-                       array("apps/index.php", "http://localhost/owncloud/apps/index.php"),
-                       );
-       }
-}
-
index bb9b7a244528722057e4215e29a0c291de0eb593..a5ec529ff85acd81c74d525e02e0c0c0542c6204 100644 (file)
@@ -8,6 +8,8 @@
 
 /**
  * Tests for server check functions
+ *
+ * @group DB
  */
 class Test_Util_CheckServer extends \Test\TestCase {