-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add an integration test for push registration
Signed-off-by: Joas Schilling <coding@schilljs.com>
- Loading branch information
1 parent
3a1126c
commit d893c79
Showing
2 changed files
with
169 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
Feature: Push registration | ||
Background: | ||
Given user "test1" exists | ||
Given as user "test1" | ||
|
||
Scenario: Invalid push token hash | ||
Given user "test1" registers for push notifications with | ||
| pushTokenHash | 12345 | | ||
| devicePublicKey | INVALID_KEY | | ||
| proxyServer | nextcloud | | ||
Then error "INVALID_PUSHTOKEN_HASH" is expected with status code 400 | ||
|
||
Scenario: Invalid device key | ||
Given user "test1" registers for push notifications with | ||
| pushTokenHash | 12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678 | | ||
| devicePublicKey | INVALID_KEY | | ||
| proxyServer | nextcloud | | ||
Then error "INVALID_DEVICE_KEY" is expected with status code 400 | ||
|
||
Scenario: Invalid proxy server | ||
Given user "test1" registers for push notifications with | ||
| pushTokenHash | 12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678 | | ||
| devicePublicKey | VALID_KEY | | ||
| proxyServer | nextcloud | | ||
Then error "INVALID_PROXY_SERVER" is expected with status code 400 | ||
|
||
Scenario: Invalid session token: not using an app password | ||
Given user "test1" registers for push notifications with | ||
| pushTokenHash | 12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678 | | ||
| devicePublicKey | VALID_KEY | | ||
| proxyServer | https://push-notifications.nextcloud.com/ | | ||
Then error "INVALID_SESSION_TOKEN" is expected with status code 400 | ||
|
||
Scenario: Successful registration | ||
Given user "test1" creates an app password | ||
Given user "test1" registers for push notifications with | ||
| pushTokenHash | 12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678 | | ||
| devicePublicKey | VALID_KEY | | ||
| proxyServer | https://push-notifications.nextcloud.com/ | | ||
Then status code is 201 | ||
And can validate the response and signature | ||
|
||
Scenario: Unregistering from push notifications without app password | ||
Given user "test1" forgets the app password | ||
Given user "test1" unregisters from push notifications | ||
Then error "INVALID_SESSION_TOKEN" is expected with status code 400 | ||
|
||
Scenario: Unregistering from push notifications successfully | ||
Given user "test1" creates an app password | ||
Given user "test1" registers for push notifications with | ||
| pushTokenHash | 12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678 | | ||
| devicePublicKey | VALID_KEY | | ||
| proxyServer | https://push-notifications.nextcloud.com/ | | ||
Then status code is 201 | ||
And can validate the response and signature | ||
Given user "test1" unregisters from push notifications | ||
Then status code is 202 | ||
Given user "test1" unregisters from push notifications | ||
Then status code is 200 | ||
|
||
Scenario: Unregistering from push notifications without registering | ||
Given user "test1" creates an app password | ||
Given user "test1" unregisters from push notifications | ||
Then status code is 200 |