Skip to content

Commit

Permalink
feat(api): added rest-client tests for VS Code
Browse files Browse the repository at this point in the history
  • Loading branch information
xmlking committed Jun 21, 2019
1 parent 15ef31d commit 521ddc3
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 6 deletions.
19 changes: 13 additions & 6 deletions .vscode/extensions.json
@@ -1,8 +1,15 @@
{
"recommendations": [
"nrwl.angular-console",
"angular.ng-template",
"ms-vscode.vscode-typescript-tslint-plugin",
"esbenp.prettier-vscode"
]
"recommendations": [
"nrwl.angular-console",
"angular.ng-template",
"ms-vscode.vscode-typescript-tslint-plugin",
"esbenp.prettier-vscode",
"googlecloudtools.cloudcode",
"DavidAnson.vscode-markdownlint",
"ms-azuretools.vscode-docker",
"EditorConfig.EditorConfig",
"donjayamanne.githistory",
"eamodio.gitlens",
"humao.rest-client"
]
}
27 changes: 27 additions & 0 deletions .vscode/settings.json
@@ -0,0 +1,27 @@
{
"editor.fontFamily": "FiraCode-Retina",
"editor.fontLigatures": true,

// REST CLIENT
"rest-client.environmentVariables": {
"$shared": {
"client-id": "ngxapi",
"username": "sumo3",
"password": "demo"
},
"local": {
"oidc-issuer-url": "https://keycloak.kashmora.com/auth/realms/ngx",
"api-url": "http://localhost:3000"
},
"local-admin": {
"oidc-issuer-url": "https://keycloak.kashmora.com/auth/realms/ngx",
"api-url": "http://localhost:3000",
"username": "ngxadmin",
"password": "ngxadmin"
},
"production": {
"oidc-issuer-url": "https://keycloak.kashmora.com/auth/realms/ngx",
"api-url": "https://api.kashmora.com"
}
}
}
35 changes: 35 additions & 0 deletions apps/api/test-rest-api-vs-code.http
@@ -0,0 +1,35 @@
### Generate JWT access token
# @name login
POST {{oidc-issuer-url}}/protocol/openid-connect/token
Content-Type: application/x-www-form-urlencoded

username={{username}}&password={{password}}&client_id={{client-id}}&grant_type=password&scope=openid

@authToken = {{login.response.body.access_token}}

### Test create notification
# @name createNotification
POST {{api-url}}/api/notifications
content-type: application/json; charset=utf-8
Authorization: Bearer {{authToken}}

{"title":"test123","body":"test12345","target":"sumo-topic","targetType":"topic","icon":"notifications","color":"warn","native":true}

### Test get notifications
# @name getNotification
GET {{api-url}}/api/notifications
Accept: application/json
Authorization: Bearer {{authToken}}


### Test send notification
# @name sendNotification
POST {{api-url}}/api/notifications/send
content-type: application/json; charset=utf-8
Authorization: Bearer {{authToken}}

{ "id" : "6a06cb98-1a3f-43ac-84e1-2312097decf9", "target": "sumo-topic" }

###


File renamed without changes.

0 comments on commit 521ddc3

Please sign in to comment.