-
-
Notifications
You must be signed in to change notification settings - Fork 272
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added new file to test git repo setup * added multiple tests for all storage api endpoints. Both positive and negative tests * added tests for GET /addresses and GET users/:user/addresses * added storage tests and fixes for them, fixed addresses tests * add test overview file
- Loading branch information
Showing
4 changed files
with
271 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
| API path | API method | Test count | Has positive test? | Has Negative test? | | ||
| --- | :---: | --- | --- | --- | | ||
| `/authenticate` | `POST` | 10 | ✅ (6) | ✅ (4) | | ||
| `/users/:user` | `GET` | 7 | ✅ (6) | ✅ (1) | | ||
| `/users/:user/addresses` | `GET` | 7 | ✅ (5) | ✅ (2) | | ||
| `/addresses` | `GET` | 6 | ✅ (5) | ✅ (1) | | ||
| `/users/:user/storage` | `POST` | 6 | ✅ (3) | ✅ (3) | | ||
| `/filters` | `GET` | 4 | ✅ (4) | ❌ (0) | | ||
| `/users` | `POST` | 4 | ✅ (3) | ✅ (1) | | ||
| `/users/:user/filters/:filter` | `PUT` | 4 | ✅ (4) | ❌ (0) | | ||
| `/users/:user/mailboxes` | `POST` | 4 | ✅ (3) | ✅ (1) | | ||
| `/users/:user/storage` | `GET` | 4 | ✅ (2) | ✅ (2) | | ||
| `/users/:user` | `PUT` | 3 | ✅ (3) | ❌ (0) | | ||
| `/users/:user/addresses/:address` | `DELETE` | 3 | ✅ (2) | ✅ (1) | | ||
| `/users/:user/asps` | `POST` | 3 | ✅ (2) | ✅ (1) | | ||
| `/users/:user/filters` | `GET` | 3 | ✅ (3) | ❌ (0) | | ||
| `/users/:user/filters` | `POST` | 3 | ✅ (3) | ❌ (0) | | ||
| `/users/:user/storage/:file` | `DELETE` | 3 | ✅ (1) | ✅ (2) | | ||
| `/users/:user/storage/:file` | `GET` | 3 | ✅ (1) | ✅ (2) | | ||
| `/addresses/forwarded` | `POST` | 2 | ✅ (2) | ❌ (0) | | ||
| `/addresses/forwarded/:id` | `PUT` | 2 | ✅ (2) | ❌ (0) | | ||
| `/authenticate` | `DELETE` | 2 | ✅ (1) | ✅ (1) | | ||
| `/certs` | `POST` | 2 | ✅ (2) | ❌ (0) | | ||
| `/domainaliases` | `POST` | 2 | ✅ (2) | ❌ (0) | | ||
| `/preauth` | `POST` | 2 | ✅ (2) | ❌ (0) | | ||
| `/users/:user/addresses` | `POST` | 2 | ✅ (2) | ❌ (0) | | ||
| `/users/:user/mailboxes/:mailbox/messages` | `POST` | 2 | ✅ (2) | ❌ (0) | | ||
| `/users/:user/mailboxes/:mailbox/messages/:message/submit` | `POST` | 2 | ✅ (1) | ✅ (1) | | ||
| `/users/:user/password/reset` | `POST` | 2 | ✅ (2) | ❌ (0) | | ||
| `/users/resolve/:username` | `GET` | 2 | ✅ (1) | ✅ (1) | | ||
| `/addresses/forwarded/:address` | `DELETE` | 1 | ✅ (1) | ❌ (0) | | ||
| `/addresses/forwarded/:address` | `GET` | 1 | ✅ (1) | ❌ (0) | | ||
| `/certs` | `GET` | 1 | ✅ (1) | ❌ (0) | | ||
| `/certs/:cert` | `GET` | 1 | ✅ (1) | ❌ (0) | | ||
| `/certs/:certs` | `DELETE` | 1 | ✅ (1) | ❌ (0) | | ||
| `/certs/resolve/:servername` | `GET` | 1 | ✅ (1) | ❌ (0) | | ||
| `/dkim` | `GET` | 1 | ✅ (1) | ❌ (0) | | ||
| `/dkim` | `POST` | 1 | ✅ (1) | ❌ (0) | | ||
| `/dkim/:dkim` | `GET` | 1 | ✅ (1) | ❌ (0) | | ||
| `/dkim/:dkim` | `DELETE` | 1 | ✅ (1) | ❌ (0) | | ||
| `/dkim/resolve/:domain` | `GET` | 1 | ✅ (1) | ❌ (0) | | ||
| `/domainaccess/:domain` | `DELETE` | 1 | ✅ (1) | ❌ (0) | | ||
| `/domainaccess/:tag/:action` | `POST` | 1 | ✅ (1) | ❌ (0) | | ||
| `/domainaccess/:tag/:action` | `GET` | 1 | ✅ (1) | ❌ (0) | | ||
| `/domainaliases` | `GET` | 1 | ✅ (1) | ❌ (0) | | ||
| `/domainaliases/:alias` | `GET` | 1 | ✅ (1) | ❌ (0) | | ||
| `/domainaliases/:alias` | `DELETE` | 1 | ✅ (1) | ❌ (0) | | ||
| `/domainaliases/resolve/:alias` | `GET` | 1 | ✅ (1) | ❌ (0) | | ||
| `/quota/reset` | `POST` | 1 | ✅ (1) | ❌ (0) | | ||
| `/users` | `GET` | 1 | ✅ (1) | ❌ (0) | | ||
| `/users/:user` | `DELETE` | 1 | ✅ (1) | ❌ (0) | | ||
| `/users/:user/addresses/:address` | `GET` | 1 | ✅ (1) | ❌ (0) | | ||
| `/users/:user/addresses/:id` | `PUT` | 1 | ✅ (1) | ❌ (0) | | ||
| `/users/:user/addressregister` | `GET` | 1 | ✅ (1) | ❌ (0) | | ||
| `/users/:user/autoreply` | `PUT` | 1 | ✅ (1) | ❌ (0) | | ||
| `/users/:user/filters/:filter` | `DELETE` | 1 | ✅ (1) | ❌ (0) | | ||
| `/users/:user/logout` | `PUT` | 1 | ✅ (1) | ❌ (0) | | ||
| `/users/:user/mailboxes` | `GET` | 1 | ✅ (1) | ❌ (0) | | ||
| `/users/:user/quota/reset` | `POST` | 1 | ✅ (1) | ❌ (0) | | ||
| `/users/:user/restore` | `GET` | 1 | ✅ (1) | ❌ (0) | | ||
| `/users/:user/restore` | `POST` | 1 | ✅ (1) | ❌ (0) | | ||
| `/.well-known/acme-challenge/:token` | `GET` | 0 | ❌ (0) | ❌ (0) | | ||
| `/addresses/renameDomain` | `PUT` | 0 | ❌ (0) | ❌ (0) | | ||
| `/addresses/resolve/:address` | `GET` | 0 | ❌ (0) | ❌ (0) | | ||
| `/api-methods` | `GET` | 0 | ❌ (0) | ❌ (0) | | ||
| `/audit` | `POST` | 0 | ❌ (0) | ❌ (0) | | ||
| `/audit/:audit` | `GET` | 0 | ❌ (0) | ❌ (0) | | ||
| `/audit/:audit/export.mbox` | `GET` | 0 | ❌ (0) | ❌ (0) | | ||
| `/data/export` | `POST` | 0 | ❌ (0) | ❌ (0) | | ||
| `/data/import` | `POST` | 0 | ❌ (0) | ❌ (0) | | ||
| `/public/*` | `GET` | 0 | ❌ (0) | ❌ (0) | | ||
| `/settings` | `GET` | 0 | ❌ (0) | ❌ (0) | | ||
| `/settings/:key` | `POST` | 0 | ❌ (0) | ❌ (0) | | ||
| `/settings/:key` | `GET` | 0 | ❌ (0) | ❌ (0) | | ||
| `/users/:user/2fa` | `DELETE` | 0 | ❌ (0) | ❌ (0) | | ||
| `/users/:user/2fa/custom` | `PUT` | 0 | ❌ (0) | ❌ (0) | | ||
| `/users/:user/2fa/custom` | `DELETE` | 0 | ❌ (0) | ❌ (0) | | ||
| `/users/:user/2fa/totp` | `DELETE` | 0 | ❌ (0) | ❌ (0) | | ||
| `/users/:user/2fa/totp/check` | `POST` | 0 | ❌ (0) | ❌ (0) | | ||
| `/users/:user/2fa/totp/enable` | `POST` | 0 | ❌ (0) | ❌ (0) | | ||
| `/users/:user/2fa/totp/setup` | `POST` | 0 | ❌ (0) | ❌ (0) | | ||
| `/users/:user/2fa/webauthn/authentication-assertion` | `POST` | 0 | ❌ (0) | ❌ (0) | | ||
| `/users/:user/2fa/webauthn/authentication-challenge` | `POST` | 0 | ❌ (0) | ❌ (0) | | ||
| `/users/:user/2fa/webauthn/credentials` | `GET` | 0 | ❌ (0) | ❌ (0) | | ||
| `/users/:user/2fa/webauthn/credentials/:credential` | `DELETE` | 0 | ❌ (0) | ❌ (0) | | ||
| `/users/:user/2fa/webauthn/registration-attestation` | `POST` | 0 | ❌ (0) | ❌ (0) | | ||
| `/users/:user/2fa/webauthn/registration-challenge` | `POST` | 0 | ❌ (0) | ❌ (0) | | ||
| `/users/:user/archived/messages` | `GET` | 0 | ❌ (0) | ❌ (0) | | ||
| `/users/:user/archived/messages/:message/restore` | `POST` | 0 | ❌ (0) | ❌ (0) | | ||
| `/users/:user/archived/restore` | `POST` | 0 | ❌ (0) | ❌ (0) | | ||
| `/users/:user/asps` | `GET` | 0 | ❌ (0) | ❌ (0) | | ||
| `/users/:user/asps/:asp` | `GET` | 0 | ❌ (0) | ❌ (0) | | ||
| `/users/:user/asps/:asp` | `DELETE` | 0 | ❌ (0) | ❌ (0) | | ||
| `/users/:user/authlog` | `GET` | 0 | ❌ (0) | ❌ (0) | | ||
| `/users/:user/authlog/:event` | `GET` | 0 | ❌ (0) | ❌ (0) | | ||
| `/users/:user/autoreply` | `GET` | 0 | ❌ (0) | ❌ (0) | | ||
| `/users/:user/autoreply` | `DELETE` | 0 | ❌ (0) | ❌ (0) | | ||
| `/users/:user/filters/:filter` | `GET` | 0 | ❌ (0) | ❌ (0) | | ||
| `/users/:user/mailboxes/:mailbox` | `GET` | 0 | ❌ (0) | ❌ (0) | | ||
| `/users/:user/mailboxes/:mailbox` | `PUT` | 0 | ❌ (0) | ❌ (0) | | ||
| `/users/:user/mailboxes/:mailbox` | `DELETE` | 0 | ❌ (0) | ❌ (0) | | ||
| `/users/:user/mailboxes/:mailbox/messages` | `GET` | 0 | ❌ (0) | ❌ (0) | | ||
| `/users/:user/mailboxes/:mailbox/messages` | `PUT` | 0 | ❌ (0) | ❌ (0) | | ||
| `/users/:user/mailboxes/:mailbox/messages` | `DELETE` | 0 | ❌ (0) | ❌ (0) | | ||
| `/users/:user/mailboxes/:mailbox/messages/:message` | `GET` | 0 | ❌ (0) | ❌ (0) | | ||
| `/users/:user/mailboxes/:mailbox/messages/:message` | `PUT` | 0 | ❌ (0) | ❌ (0) | | ||
| `/users/:user/mailboxes/:mailbox/messages/:message` | `DELETE` | 0 | ❌ (0) | ❌ (0) | | ||
| `/users/:user/mailboxes/:mailbox/messages/:message/attachments/:attachment` | `GET` | 0 | ❌ (0) | ❌ (0) | | ||
| `/users/:user/mailboxes/:mailbox/messages/:message/forward` | `POST` | 0 | ❌ (0) | ❌ (0) | | ||
| `/users/:user/mailboxes/:mailbox/messages/:message/message.eml` | `GET` | 0 | ❌ (0) | ❌ (0) | | ||
| `/users/:user/outbound/:queueId` | `DELETE` | 0 | ❌ (0) | ❌ (0) | | ||
| `/users/:user/search` | `GET` | 0 | ❌ (0) | ❌ (0) | | ||
| `/users/:user/search` | `POST` | 0 | ❌ (0) | ❌ (0) | | ||
| `/users/:user/submit` | `POST` | 0 | ❌ (0) | ❌ (0) | | ||
| `/users/:user/updates` | `GET` | 0 | ❌ (0) | ❌ (0) | | ||
| `/webhooks` | `GET` | 0 | ❌ (0) | ❌ (0) | | ||
| `/webhooks` | `POST` | 0 | ❌ (0) | ❌ (0) | | ||
| `/webhooks/:webhook` | `DELETE` | 0 | ❌ (0) | ❌ (0) | |
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,2 @@ | ||
test file new for git | ||
|
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 |
---|---|---|
|
@@ -100,6 +100,11 @@ describe('API Users', function () { | |
expect(addressListResponse.body.total).to.gt(3); | ||
}); | ||
|
||
it('should GET /addresses expect failure / incorrect query params data', async () => { | ||
const addressListResponse = await server.get(`/addresses?limit=-1&query=${'a'.repeat(256)}`).expect(400); | ||
expect(addressListResponse.body.code).to.be.equal('InputValidationError'); | ||
}); | ||
|
||
it('should GET /addresses expect success / with tags', async () => { | ||
const addressListResponse = await server.get(`/addresses?tags=tag2,tag3`).expect(200); | ||
expect(addressListResponse.body.success).to.be.true; | ||
|
@@ -142,6 +147,17 @@ describe('API Users', function () { | |
expect(addressListResponse.body.results.find(addr => addr.main).address).to.equal('[email protected]'); | ||
}); | ||
|
||
it('should GET /users/{user}/addresses expect failure / incorrect user', async () => { | ||
const addressListResponse = await server.get(`/users/${123}/addresses`).expect(400); | ||
expect(addressListResponse.body.code).to.be.equal('InputValidationError'); | ||
}); | ||
|
||
it('should GET /users/{user}/addresses expect failure / user missing', async () => { | ||
const addressListResponse = await server.get(`/users/${'0'.repeat(24)}/addresses`).expect(404); | ||
expect(addressListResponse.body.code).to.be.equal('UserNotFound'); | ||
expect(addressListResponse.body.error).to.be.equal('This user does not exist'); | ||
}); | ||
|
||
it('should PUT /users/{user}/addresses/{id} expect success', async () => { | ||
let addressListResponse = await server.get(`/users/${user}/addresses`).expect(200); | ||
expect(addressListResponse.body.success).to.be.true; | ||
|
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