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

github.com/nextcloud/notifications.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2016-08-31 16:46:30 +0300
committerJoas Schilling <coding@schilljs.com>2016-08-31 16:46:30 +0300
commitbec6e4c8be265930d95c7b668f1bcb202c9a6d25 (patch)
treeb1efb502b491ca505d46b25fc86d15204890b3e8 /tests/Integration
parent74241294c00784e12b85b0a9cac8ca86972cdc1a (diff)
Fix integration tests on master
Diffstat (limited to 'tests/Integration')
-rw-r--r--tests/Integration/app/appinfo/info.xml2
-rw-r--r--tests/Integration/app/appinfo/routes.php4
-rw-r--r--tests/Integration/app/controller.php2
-rw-r--r--tests/Integration/features/bootstrap/FeatureContext.php30
-rw-r--r--tests/Integration/features/delete-notifications.feature2
-rw-r--r--tests/Integration/features/notifications-content.feature10
-rw-r--r--tests/Integration/features/statuscodes.feature2
-rw-r--r--tests/Integration/run.sh6
8 files changed, 37 insertions, 21 deletions
diff --git a/tests/Integration/app/appinfo/info.xml b/tests/Integration/app/appinfo/info.xml
index 4eda6d8..c21ef11 100644
--- a/tests/Integration/app/appinfo/info.xml
+++ b/tests/Integration/app/appinfo/info.xml
@@ -14,6 +14,6 @@
<dependencies>
<owncloud min-version="9.0" />
- <owncloud max-version="9.0" />
+ <owncloud max-version="9.2" />
</dependencies>
</info>
diff --git a/tests/Integration/app/appinfo/routes.php b/tests/Integration/app/appinfo/routes.php
index c2bba93..ff5bb45 100644
--- a/tests/Integration/app/appinfo/routes.php
+++ b/tests/Integration/app/appinfo/routes.php
@@ -28,11 +28,11 @@ $controller = new \OCA\NotificationsIntegrationTesting\Controller(
'delete',
'/apps/notificationsintegrationtesting',
[$controller, 'deleteNotifications'],
- 'notifications'
+ 'notificationsintegrationtesting'
);
\OCP\API::register(
'post',
'/apps/notificationsintegrationtesting/notifications',
[$controller, 'addNotification'],
- 'notifications'
+ 'notificationsintegrationtesting'
);
diff --git a/tests/Integration/app/controller.php b/tests/Integration/app/controller.php
index 77ab598..96abd5a 100644
--- a/tests/Integration/app/controller.php
+++ b/tests/Integration/app/controller.php
@@ -52,7 +52,7 @@ class Controller extends \OCP\AppFramework\Controller {
->setDateTime(\DateTime::createFromFormat('U', $this->request->getParam('timestamp', 1449585176))) // 2015-12-08T14:32:56+00:00
->setUser($this->request->getParam('user', 'test1'))
->setSubject($this->request->getParam('subject', 'testing'))
- ->setLink($this->request->getParam('link', 'https://www.owncloud.org/'))
+ ->setLink($this->request->getParam('link', 'https://example.tld/'))
->setMessage($this->request->getParam('message', 'message'))
->setObject($this->request->getParam('object_type', 'object'), $this->request->getParam('object_id', 23));
diff --git a/tests/Integration/features/bootstrap/FeatureContext.php b/tests/Integration/features/bootstrap/FeatureContext.php
index ab91ba6..1e7ec4b 100644
--- a/tests/Integration/features/bootstrap/FeatureContext.php
+++ b/tests/Integration/features/bootstrap/FeatureContext.php
@@ -46,6 +46,9 @@ class FeatureContext implements Context, SnippetAcceptingContext {
/** @var \GuzzleHttp\Cookie\CookieJar */
private $cookieJar;
+ /** @var string */
+ protected $baseUrl;
+
/**
* FeatureContext constructor.
*/
@@ -220,7 +223,7 @@ class FeatureContext implements Context, SnippetAcceptingContext {
*/
/**
- * @Given /^As user "([^"]*)"$/
+ * @Given /^as user "([^"]*)"$/
* @param string $user
*/
public function setCurrentUser($user) {
@@ -237,15 +240,20 @@ class FeatureContext implements Context, SnippetAcceptingContext {
} catch (\GuzzleHttp\Exception\ClientException $ex) {
$this->createUser($user);
}
- $this->userExists($user);
- PHPUnit_Framework_Assert::assertEquals(200, $this->response->getStatusCode());
+ $response = $this->userExists($user);
+ PHPUnit_Framework_Assert::assertEquals(200, $response->getStatusCode());
}
private function userExists($user) {
$client = new Client();
- $options = ['auth' => ['admin', 'admin']];
- $this->response = $client->get($this->baseUrl . 'ocs/v2.php/cloud/users/' . $user, $options);
+ $options = [
+ 'auth' => ['admin', 'admin'],
+ 'headers' => [
+ 'OCS-APIREQUEST' => 'true',
+ ],
+ ];
+ return $client->get($this->baseUrl . 'ocs/v2.php/cloud/users/' . $user, $options);
}
private function createUser($user) {
@@ -260,11 +268,19 @@ class FeatureContext implements Context, SnippetAcceptingContext {
'userid' => $user,
'password' => '123456'
],
+ 'headers' => [
+ 'OCS-APIREQUEST' => 'true',
+ ],
];
- $this->response = $client->send($client->createRequest('POST', $userProvisioningUrl, $options));
+ $client->send($client->createRequest('POST', $userProvisioningUrl, $options));
//Quick hack to login once with the current user
- $options2 = ['auth' => [$user, '123456']];
+ $options2 = [
+ 'auth' => [$user, '123456'],
+ 'headers' => [
+ 'OCS-APIREQUEST' => 'true',
+ ],
+ ];
$client->send($client->createRequest('GET', $userProvisioningUrl . '/' . $user, $options2));
$this->currentUser = $previous_user;
diff --git a/tests/Integration/features/delete-notifications.feature b/tests/Integration/features/delete-notifications.feature
index c2cccb3..01d5258 100644
--- a/tests/Integration/features/delete-notifications.feature
+++ b/tests/Integration/features/delete-notifications.feature
@@ -1,7 +1,7 @@
Feature: delete-notifications
Background:
Given user "test1" exists
- Given As user "test1"
+ Given as user "test1"
Scenario: Delete first notification
Given user "test1" has notifications
diff --git a/tests/Integration/features/notifications-content.feature b/tests/Integration/features/notifications-content.feature
index 1366eb4..3f9aef6 100644
--- a/tests/Integration/features/notifications-content.feature
+++ b/tests/Integration/features/notifications-content.feature
@@ -1,14 +1,14 @@
Feature: notifications-content
Background:
Given user "test1" exists
- Given As user "test1"
+ Given as user "test1"
Scenario: Create notification
Given user "test1" receives notification with
| app | notificationsintegrationtesting |
| timestamp | 144958517 |
| subject | Integration testing |
- | link | https://owncloud.org/blog/about-activities-and-notifications-in-owncloud/ |
+ | link | https://example.tld/blog/about-notifications/ |
| message | About Activities and Notifications in ownCloud |
| object_type | blog |
| object_id | 9483 |
@@ -17,7 +17,7 @@ Feature: notifications-content
| app | notificationsintegrationtesting |
| datetime | 1974-08-05T18:15:17+00:00 |
| subject | Integration testing |
- | link | https://owncloud.org/blog/about-activities-and-notifications-in-owncloud/ |
+ | link | https://example.tld/blog/about-notifications/ |
| message | About Activities and Notifications in ownCloud |
| object_type | blog |
| object_id | 9483 |
@@ -27,7 +27,7 @@ Feature: notifications-content
| app | notificationsintegrationtesting |
| timestamp | 144958515 |
| subject | Testing integration |
- | link | https://github.com/owncloud/notifications/blob/master/docs/ocs-endpoint-v1.md |
+ | link | https://github.com/nextcloud/notifications/blob/master/docs/ocs-endpoint-v1.md |
| message | Reading and deleting notifications as a Client |
| object_type | repo |
| object_id | notifications |
@@ -36,7 +36,7 @@ Feature: notifications-content
| app | notificationsintegrationtesting |
| datetime | 1974-08-05T18:15:15+00:00 |
| subject | Testing integration |
- | link | https://github.com/owncloud/notifications/blob/master/docs/ocs-endpoint-v1.md |
+ | link | https://github.com/nextcloud/notifications/blob/master/docs/ocs-endpoint-v1.md |
| message | Reading and deleting notifications as a Client |
| object_type | repo |
| object_id | notifications |
diff --git a/tests/Integration/features/statuscodes.feature b/tests/Integration/features/statuscodes.feature
index c9a68d3..2a793ea 100644
--- a/tests/Integration/features/statuscodes.feature
+++ b/tests/Integration/features/statuscodes.feature
@@ -1,7 +1,7 @@
Feature: statuscodes
Background:
Given user "test1" exists
- Given As user "test1"
+ Given as user "test1"
Scenario: Status code when reading notifications with notifiers and without notifications
When sending "GET" to "/apps/notifications/api/v1/notifications?format=json"
diff --git a/tests/Integration/run.sh b/tests/Integration/run.sh
index 6d51763..ef79bde 100644
--- a/tests/Integration/run.sh
+++ b/tests/Integration/run.sh
@@ -4,10 +4,7 @@ APP_NAME=notifications
APP_INTEGRATION_DIR=$PWD
ROOT_DIR=${APP_INTEGRATION_DIR}/../../../..
-
-#cd ${ROOT_DIR}/build/integration
composer install
-#cd ${APP_INTEGRATION_DIR}
php -S localhost:8080 -t ${ROOT_DIR} &
PHPPID=$!
@@ -16,6 +13,9 @@ echo $PHPPID
cp -R ./app ../../../notificationsintegrationtesting
${ROOT_DIR}/occ app:enable notifications
${ROOT_DIR}/occ app:enable notificationsintegrationtesting
+${ROOT_DIR}/occ app:enable provisioning_api
+${ROOT_DIR}/occ app:list | grep notifications
+${ROOT_DIR}/occ app:list | grep provisioning_api
export TEST_SERVER_URL="http://localhost:8080/"
${APP_INTEGRATION_DIR}/vendor/bin/behat -f junit -f pretty