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>2017-04-04 12:41:43 +0300
committerJoas Schilling <coding@schilljs.com>2017-04-04 12:41:43 +0300
commit60e4a9d40301e932471c3ebbfd8567cb8cc3041a (patch)
treeadac45530d1e9ca0a7d89048515e77cd9ef306d2 /tests/Integration
parented518b1cdcf6b8f8135804706204c17a2f732ccc (diff)
Implement correct ETag support
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests/Integration')
-rw-r--r--tests/Integration/features/bootstrap/FeatureContext.php11
-rw-r--r--tests/Integration/features/statuscodes-v1.feature4
-rw-r--r--tests/Integration/features/statuscodes-v2.feature4
-rw-r--r--tests/Integration/run.sh2
4 files changed, 15 insertions, 6 deletions
diff --git a/tests/Integration/features/bootstrap/FeatureContext.php b/tests/Integration/features/bootstrap/FeatureContext.php
index 0ec634f..6ea471b 100644
--- a/tests/Integration/features/bootstrap/FeatureContext.php
+++ b/tests/Integration/features/bootstrap/FeatureContext.php
@@ -93,9 +93,9 @@ class FeatureContext implements Context, SnippetAcceptingContext {
public function gettingNotifications($api, $etag) {
$headers = [];
if ($etag === ' with different etag') {
- $headers['ETag'] = md5($this->lastEtag);
+ $headers['If-None-Match'] = substr($this->lastEtag, 0, 16);
} else if ($etag === ' with matching etag') {
- $headers['ETag'] = $this->lastEtag;
+ $headers['If-None-Match'] = $this->lastEtag;
}
$this->sendingToWith('GET', '/apps/notifications/api/' . $api . '/notifications?format=json', null, $headers);
@@ -103,6 +103,13 @@ class FeatureContext implements Context, SnippetAcceptingContext {
}
/**
+ * @Then /^response body is empty$/
+ */
+ public function checkResponseBodyIsEmpty() {
+ PHPUnit_Framework_Assert::assertSame('', $this->response->getBody()->getContents());
+ }
+
+ /**
* @Then /^list of notifications has (\d+) entries$/
*
* @param int $numNotifications
diff --git a/tests/Integration/features/statuscodes-v1.feature b/tests/Integration/features/statuscodes-v1.feature
index 4049df0..7efeaf5 100644
--- a/tests/Integration/features/statuscodes-v1.feature
+++ b/tests/Integration/features/statuscodes-v1.feature
@@ -41,5 +41,7 @@ Feature: statuscodes
Then status code is 200
And list of notifications has 3 entries
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
+ Then status code is 200
+ # And response body is empty - Disabled because it's not listed in the API specs
+ And list of notifications has 3 entries
diff --git a/tests/Integration/features/statuscodes-v2.feature b/tests/Integration/features/statuscodes-v2.feature
index 4b03417..8fb950d 100644
--- a/tests/Integration/features/statuscodes-v2.feature
+++ b/tests/Integration/features/statuscodes-v2.feature
@@ -41,5 +41,5 @@ Feature: statuscodes
Then status code is 200
And list of notifications has 3 entries
When getting notifications on v2 with matching etag
- Then status code is 200
- # Then status code is 304 - Disabled because it's not listed in the API specs
+ Then status code is 304
+ And response body is empty
diff --git a/tests/Integration/run.sh b/tests/Integration/run.sh
index ef79bde..b02af77 100644
--- a/tests/Integration/run.sh
+++ b/tests/Integration/run.sh
@@ -18,7 +18,7 @@ ${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
+${APP_INTEGRATION_DIR}/vendor/bin/behat -f junit -f pretty $1 $2
RESULT=$?
kill $PHPPID