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-10-31 16:40:40 +0300
committerJoas Schilling <coding@schilljs.com>2016-10-31 16:48:17 +0300
commit52880b9d5d556cc44caeff892aa1ebac468f7d48 (patch)
tree834e0c3a42dd103b1b22392a5beef8d91b241712 /tests/Integration
parent19cc41a9ceb4c68e5b3093c8bd6c04d6541a880a (diff)
Prepare integration tests for v2
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests/Integration')
-rw-r--r--tests/Integration/features/bootstrap/FeatureContext.php29
-rw-r--r--tests/Integration/features/delete-notifications-v1.feature (renamed from tests/Integration/features/delete-notifications.feature)26
-rw-r--r--tests/Integration/features/notifications-content-v1.feature (renamed from tests/Integration/features/notifications-content.feature)8
-rw-r--r--tests/Integration/features/statuscodes-v1.feature (renamed from tests/Integration/features/statuscodes.feature)14
4 files changed, 41 insertions, 36 deletions
diff --git a/tests/Integration/features/bootstrap/FeatureContext.php b/tests/Integration/features/bootstrap/FeatureContext.php
index d151fc6..0ec634f 100644
--- a/tests/Integration/features/bootstrap/FeatureContext.php
+++ b/tests/Integration/features/bootstrap/FeatureContext.php
@@ -86,9 +86,11 @@ class FeatureContext implements Context, SnippetAcceptingContext {
}
/**
- * @When /^getting notifications(| with different etag| with matching etag)$/
+ * @When /^getting notifications on (v\d+)(| with different etag| with matching etag)$/
+ * @param string $api
+ * @param string $etag
*/
- public function gettingNotifications($etag) {
+ public function gettingNotifications($api, $etag) {
$headers = [];
if ($etag === ' with different etag') {
$headers['ETag'] = md5($this->lastEtag);
@@ -96,7 +98,7 @@ class FeatureContext implements Context, SnippetAcceptingContext {
$headers['ETag'] = $this->lastEtag;
}
- $this->sendingToWith('GET', '/apps/notifications/api/v1/notifications?format=json', null, $headers);
+ $this->sendingToWith('GET', '/apps/notifications/api/' . $api . '/notifications?format=json', null, $headers);
$this->lastEtag = $this->response->getHeader('ETag');
}
@@ -127,15 +129,16 @@ class FeatureContext implements Context, SnippetAcceptingContext {
}
/**
- * @Then /^user "([^"]*)" has (\d+) notifications(| missing the last one| missing the first one)$/
+ * @Then /^user "([^"]*)" has (\d+) notifications on (v\d+)(| missing the last one| missing the first one)$/
*
* @param string $user
* @param int $numNotifications
+ * @param string $api
* @param string $missingLast
*/
- public function userNumNotifications($user, $numNotifications, $missingLast) {
+ public function userNumNotifications($user, $numNotifications, $api, $missingLast) {
if ($user === 'test1') {
- $this->sendingTo('GET', '/apps/notifications/api/v1/notifications?format=json');
+ $this->sendingTo('GET', '/apps/notifications/api/' . $api . '/notifications?format=json');
$this->assertStatusCode($this->response, 200);
$previousNotificationIds = [];
@@ -161,12 +164,13 @@ class FeatureContext implements Context, SnippetAcceptingContext {
}
/**
- * @Then /^(first|last) notification matches$/
+ * @Then /^(first|last) notification on (v\d+) matches$/
*
* @param string $notification
+ * @param string $api
* @param \Behat\Gherkin\Node\TableNode|null $formData
*/
- public function matchNotification($notification, $formData) {
+ public function matchNotification($notification, $api, $formData) {
$lastNotifications = end($this->notificationIds);
if ($notification === 'first') {
$notificationId = reset($lastNotifications);
@@ -174,7 +178,7 @@ class FeatureContext implements Context, SnippetAcceptingContext {
$notificationId = end($lastNotifications);
}
- $this->sendingTo('GET', '/apps/notifications/api/v1/notifications/' . $notificationId . '?format=json');
+ $this->sendingTo('GET', '/apps/notifications/api/' . $api . '/notifications/' . $notificationId . '?format=json');
$this->assertStatusCode($this->response, 200);
$response = $this->response->json();
@@ -185,11 +189,12 @@ class FeatureContext implements Context, SnippetAcceptingContext {
}
/**
- * @Then /^delete (first|last|same|faulty) notification$/
+ * @Then /^delete (first|last|same|faulty) notification on (v\d+)$/
*
* @param string $toDelete
+ * @param string $api
*/
- public function deleteNotification($toDelete) {
+ public function deleteNotification($toDelete, $api) {
PHPUnit_Framework_Assert::assertNotEmpty($this->notificationIds);
$lastNotificationIds = end($this->notificationIds);
if ($toDelete === 'first') {
@@ -199,7 +204,7 @@ class FeatureContext implements Context, SnippetAcceptingContext {
} else if ($toDelete === 'faulty') {
$this->deletedNotification = 'faulty';
}
- $this->sendingTo('DELETE', '/apps/notifications/api/v1/notifications/' . $this->deletedNotification);
+ $this->sendingTo('DELETE', '/apps/notifications/api/' . $api . '/notifications/' . $this->deletedNotification);
}
/**
diff --git a/tests/Integration/features/delete-notifications.feature b/tests/Integration/features/delete-notifications-v1.feature
index 75daab8..5116771 100644
--- a/tests/Integration/features/delete-notifications.feature
+++ b/tests/Integration/features/delete-notifications-v1.feature
@@ -7,36 +7,36 @@ Feature: delete-notifications
Given user "test1" has notifications
Given user "test1" has notifications
Given user "test1" has notifications
- Then user "test1" has 3 notifications
- And delete first notification
+ Then user "test1" has 3 notifications on v1
+ And delete first notification on v1
And status code is 200
- And user "test1" has 2 notifications missing the first one
+ And user "test1" has 2 notifications on v1 missing the first one
Scenario: Delete same notification twice
Given user "test1" has notifications
Given user "test1" has notifications
Given user "test1" has notifications
- When user "test1" has 3 notifications
- And delete first notification
+ When user "test1" has 3 notifications on v1
+ And delete first notification on v1
And status code is 200
- And delete same notification
+ And delete same notification on v1
And status code is 200
- And user "test1" has 2 notifications missing the first one
+ And user "test1" has 2 notifications on v1 missing the first one
Scenario: Delete faulty notification
Given user "test1" has notifications
Given user "test1" has notifications
Given user "test1" has notifications
- When user "test1" has 3 notifications
- And delete faulty notification
+ When user "test1" has 3 notifications on v1
+ And delete faulty notification on v1
And status code is 404
- And user "test1" has 3 notifications
+ And user "test1" has 3 notifications on v1
Scenario: Delete last notification
Given user "test1" has notifications
Given user "test1" has notifications
Given user "test1" has notifications
- Then user "test1" has 3 notifications
- And delete last notification
+ Then user "test1" has 3 notifications on v1
+ And delete last notification on v1
And status code is 200
- And user "test1" has 2 notifications missing the last one
+ And user "test1" has 2 notifications on v1 missing the last one
diff --git a/tests/Integration/features/notifications-content.feature b/tests/Integration/features/notifications-content-v1.feature
index 3f9aef6..10994fa 100644
--- a/tests/Integration/features/notifications-content.feature
+++ b/tests/Integration/features/notifications-content-v1.feature
@@ -12,8 +12,8 @@ Feature: notifications-content
| message | About Activities and Notifications in ownCloud |
| object_type | blog |
| object_id | 9483 |
- Then user "test1" has 1 notifications
- And last notification matches
+ Then user "test1" has 1 notifications on v1
+ And last notification on v1 matches
| app | notificationsintegrationtesting |
| datetime | 1974-08-05T18:15:17+00:00 |
| subject | Integration testing |
@@ -31,8 +31,8 @@ Feature: notifications-content
| message | Reading and deleting notifications as a Client |
| object_type | repo |
| object_id | notifications |
- Then user "test1" has 1 notifications
- And last notification matches
+ Then user "test1" has 1 notifications on v1
+ And last notification on v1 matches
| app | notificationsintegrationtesting |
| datetime | 1974-08-05T18:15:15+00:00 |
| subject | Testing integration |
diff --git a/tests/Integration/features/statuscodes.feature b/tests/Integration/features/statuscodes-v1.feature
index b0a9cdd..4049df0 100644
--- a/tests/Integration/features/statuscodes.feature
+++ b/tests/Integration/features/statuscodes-v1.feature
@@ -4,13 +4,13 @@ Feature: statuscodes
Given as user "test1"
Scenario: Status code when reading notifications with notifiers and without notifications
- When getting notifications
+ When getting notifications on v1
Then status code is 200
And list of notifications has 0 entries
Scenario: Status code when reading notifications with notifiers and notification
Given user "test1" has notifications
- When getting notifications
+ When getting notifications on v1
Then status code is 200
And list of notifications has 1 entries
@@ -18,7 +18,7 @@ Feature: statuscodes
Given user "test1" has notifications
Given user "test1" has notifications
Given user "test1" has notifications
- When getting notifications
+ When getting notifications on v1
Then status code is 200
And list of notifications has 3 entries
@@ -26,10 +26,10 @@ Feature: statuscodes
Given user "test1" has notifications
Given user "test1" has notifications
Given user "test1" has notifications
- When getting notifications
+ When getting notifications on v1
Then status code is 200
And list of notifications has 3 entries
- When getting notifications with different etag
+ When getting notifications on v1 with different etag
Then status code is 200
And list of notifications has 3 entries
@@ -37,9 +37,9 @@ Feature: statuscodes
Given user "test1" has notifications
Given user "test1" has notifications
Given user "test1" has notifications
- When getting notifications
+ When getting notifications on v1
Then status code is 200
And list of notifications has 3 entries
- When getting notifications with matching etag
+ When getting notifications on v1 with matching etag
Then status code is 200
# Then status code is 304 - Disabled because it's not listed in the API specs