Update Bruno collection and add prescript for automatic login based on environment,
This commit is contained in:
parent
7ab5923ebb
commit
3155a356b9
21 changed files with 202 additions and 158 deletions
8
bruno/recipe-backend/AuthPoint/folder.bru
Normal file
8
bruno/recipe-backend/AuthPoint/folder.bru
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
meta {
|
||||||
|
name: AuthPoint
|
||||||
|
seq: 2
|
||||||
|
}
|
||||||
|
|
||||||
|
auth {
|
||||||
|
mode: inherit
|
||||||
|
}
|
||||||
28
bruno/recipe-backend/AuthPoint/login.bru
Normal file
28
bruno/recipe-backend/AuthPoint/login.bru
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
meta {
|
||||||
|
name: login
|
||||||
|
type: http
|
||||||
|
seq: 2
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
url: {{url}}/auth/login
|
||||||
|
body: json
|
||||||
|
auth: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
body:json {
|
||||||
|
{
|
||||||
|
"userName": "{{username}}",
|
||||||
|
"password": "{{password}}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
script:post-response {
|
||||||
|
const body = res.getBody()
|
||||||
|
bru.setEnvVar("token", body.token)
|
||||||
|
bru.setEnvVar("tokenExpireDate", new Date().valueOf() + (body.expiryDate))
|
||||||
|
}
|
||||||
|
|
||||||
|
settings {
|
||||||
|
encodeUrl: true
|
||||||
|
}
|
||||||
8
bruno/recipe-backend/CompactRecipePoint/folder.bru
Normal file
8
bruno/recipe-backend/CompactRecipePoint/folder.bru
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
meta {
|
||||||
|
name: CompactRecipePoint
|
||||||
|
seq: 4
|
||||||
|
}
|
||||||
|
|
||||||
|
auth {
|
||||||
|
mode: inherit
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
meta {
|
||||||
|
name: getCompactRecipes
|
||||||
|
type: http
|
||||||
|
seq: 2
|
||||||
|
}
|
||||||
|
|
||||||
|
get {
|
||||||
|
url: {{url}}/compact-recipe?search=kuchen
|
||||||
|
body: none
|
||||||
|
auth: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
params:query {
|
||||||
|
search: kuchen
|
||||||
|
}
|
||||||
|
|
||||||
|
settings {
|
||||||
|
encodeUrl: true
|
||||||
|
}
|
||||||
|
|
@ -1,17 +1,13 @@
|
||||||
meta {
|
meta {
|
||||||
name: createRecipe
|
name: createRecipe
|
||||||
type: http
|
type: http
|
||||||
seq: 4
|
seq: 2
|
||||||
}
|
}
|
||||||
|
|
||||||
post {
|
post {
|
||||||
url: http://localhost:4000/recipe/create-or-update
|
url: {{url}}/recipe/create-or-update
|
||||||
body: json
|
body: json
|
||||||
auth: bearer
|
auth: inherit
|
||||||
}
|
|
||||||
|
|
||||||
auth:bearer {
|
|
||||||
token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImE0NDdlNDM0LTQyMWYtNDJiYS04MGRlLTM0ZDE1YzJmNWE2YyIsImlhdCI6MTc2MDExNzA3MywiZXhwIjoxNzYwMjAzNDczfQ.NEfrUuzFcxocgN52uhptku5QVUbg03nmrN1E6A6XycA
|
|
||||||
}
|
}
|
||||||
|
|
||||||
body:json {
|
body:json {
|
||||||
8
bruno/recipe-backend/RecipePoint/folder.bru
Normal file
8
bruno/recipe-backend/RecipePoint/folder.bru
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
meta {
|
||||||
|
name: RecipePoint
|
||||||
|
seq: 3
|
||||||
|
}
|
||||||
|
|
||||||
|
auth {
|
||||||
|
mode: inherit
|
||||||
|
}
|
||||||
33
bruno/recipe-backend/RecipePoint/getRecipeById.bru
Normal file
33
bruno/recipe-backend/RecipePoint/getRecipeById.bru
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
meta {
|
||||||
|
name: getRecipeById
|
||||||
|
type: http
|
||||||
|
seq: 3
|
||||||
|
}
|
||||||
|
|
||||||
|
get {
|
||||||
|
url: {{url}}/recipe/fa608340-d679-4267-8b89-c743bd7fc234
|
||||||
|
body: none
|
||||||
|
auth: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
script:pre-request {
|
||||||
|
try{
|
||||||
|
// An dieser Stelle muss überprüft werden, ob diese Funktion gerade aufgerufen wird, ansonsten entsteht eine Endlosschleife.
|
||||||
|
const blocked = bru.getEnvVar("blocked");
|
||||||
|
if(blocked === "false" && new Date().valueOf() > Number(bru.getEnvVar("tokenExpireDate"))){
|
||||||
|
console.log('new Session')
|
||||||
|
|
||||||
|
bru.setEnvVar("blocked",true)
|
||||||
|
// Absoluter Pfad von der Collection-Root
|
||||||
|
await bru.runRequest('login.bru')
|
||||||
|
|
||||||
|
bru.setEnvVar("blocked",false)
|
||||||
|
}
|
||||||
|
} catch (e){
|
||||||
|
console.log(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
settings {
|
||||||
|
encodeUrl: true
|
||||||
|
}
|
||||||
|
|
@ -1,17 +1,13 @@
|
||||||
meta {
|
meta {
|
||||||
name: updateRecipe
|
name: updateRecipe
|
||||||
type: http
|
type: http
|
||||||
seq: 7
|
seq: 3
|
||||||
}
|
}
|
||||||
|
|
||||||
post {
|
post {
|
||||||
url: http://localhost:4000/recipe/create-or-update
|
url: {{url}}/recipe/create-or-update
|
||||||
body: json
|
body: json
|
||||||
auth: bearer
|
auth: inherit
|
||||||
}
|
|
||||||
|
|
||||||
auth:bearer {
|
|
||||||
token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImE0NDdlNDM0LTQyMWYtNDJiYS04MGRlLTM0ZDE1YzJmNWE2YyIsImlhdCI6MTc1OTU5MTk1MiwiZXhwIjoxNzU5Njc4MzUyfQ.gkvuBtq8OaC7OqnArPcrV7jd34Ll7jHYXRbvz847aiw
|
|
||||||
}
|
}
|
||||||
|
|
||||||
body:json {
|
body:json {
|
||||||
|
|
@ -105,6 +101,24 @@ body:json {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
script:pre-request {
|
||||||
|
try{
|
||||||
|
// An dieser Stelle muss überprüft werden, ob diese Funktion gerade aufgerufen wird, ansonsten entsteht eine Endlosschleife.
|
||||||
|
const blocked = bru.getEnvVar("blocked");
|
||||||
|
if(blocked === "false" && new Date().valueOf() > Number(bru.getEnvVar("tokenExpireDate"))){
|
||||||
|
console.log('new Session')
|
||||||
|
|
||||||
|
bru.setEnvVar("blocked",true)
|
||||||
|
// Absoluter Pfad von der Collection-Root
|
||||||
|
await bru.runRequest('login.bru')
|
||||||
|
|
||||||
|
bru.setEnvVar("blocked",false)
|
||||||
|
}
|
||||||
|
} catch (e){
|
||||||
|
console.log(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
settings {
|
settings {
|
||||||
encodeUrl: true
|
encodeUrl: true
|
||||||
}
|
}
|
||||||
25
bruno/recipe-backend/UserPoint/createUser.bru
Normal file
25
bruno/recipe-backend/UserPoint/createUser.bru
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
meta {
|
||||||
|
name: createUser
|
||||||
|
type: http
|
||||||
|
seq: 2
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
url: {{url}}/user/create
|
||||||
|
body: json
|
||||||
|
auth: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
body:json {
|
||||||
|
{
|
||||||
|
"userData": {
|
||||||
|
"userName": "bruno",
|
||||||
|
"email": "test@raemer.net"
|
||||||
|
},
|
||||||
|
"password": "bruno"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
settings {
|
||||||
|
encodeUrl: true
|
||||||
|
}
|
||||||
8
bruno/recipe-backend/UserPoint/folder.bru
Normal file
8
bruno/recipe-backend/UserPoint/folder.bru
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
meta {
|
||||||
|
name: UserPoint
|
||||||
|
seq: 5
|
||||||
|
}
|
||||||
|
|
||||||
|
auth {
|
||||||
|
mode: inherit
|
||||||
|
}
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
meta {
|
meta {
|
||||||
name: getRecipeById
|
name: getAllUsers
|
||||||
type: http
|
type: http
|
||||||
seq: 6
|
seq: 7
|
||||||
}
|
}
|
||||||
|
|
||||||
get {
|
get {
|
||||||
url: https://localhost:4000/recipe/
|
url: {{url}}/user/all
|
||||||
body: none
|
body: none
|
||||||
auth: inherit
|
auth: inherit
|
||||||
}
|
}
|
||||||
15
bruno/recipe-backend/UserPoint/me.bru
Normal file
15
bruno/recipe-backend/UserPoint/me.bru
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
meta {
|
||||||
|
name: me
|
||||||
|
type: http
|
||||||
|
seq: 3
|
||||||
|
}
|
||||||
|
|
||||||
|
get {
|
||||||
|
url: {{url}}/user/me
|
||||||
|
body: none
|
||||||
|
auth: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
settings {
|
||||||
|
encodeUrl: true
|
||||||
|
}
|
||||||
|
|
@ -1,17 +1,13 @@
|
||||||
meta {
|
meta {
|
||||||
name: updateUser
|
name: updateUser
|
||||||
type: http
|
type: http
|
||||||
seq: 8
|
seq: 7
|
||||||
}
|
}
|
||||||
|
|
||||||
post {
|
post {
|
||||||
url: http://localhost:4000/user/update
|
url: {{url}}/user/update
|
||||||
body: json
|
body: json
|
||||||
auth: bearer
|
auth: inherit
|
||||||
}
|
|
||||||
|
|
||||||
auth:bearer {
|
|
||||||
token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImE0NDdlNDM0LTQyMWYtNDJiYS04MGRlLTM0ZDE1YzJmNWE2YyIsImlhdCI6MTc2MzQ5MDcxMywiZXhwIjoxNzYzNTc3MTEzfQ.h8ta-4tVhR7EskZDBLtcFTQ7QllV-PfC09Y0DLjYJa4
|
|
||||||
}
|
}
|
||||||
|
|
||||||
body:json {
|
body:json {
|
||||||
|
|
@ -1,26 +0,0 @@
|
||||||
meta {
|
|
||||||
name: changePassword
|
|
||||||
type: http
|
|
||||||
seq: 11
|
|
||||||
}
|
|
||||||
|
|
||||||
post {
|
|
||||||
url: http://localhost:4000/user/change-password
|
|
||||||
body: json
|
|
||||||
auth: bearer
|
|
||||||
}
|
|
||||||
|
|
||||||
auth:bearer {
|
|
||||||
token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImE0NDdlNDM0LTQyMWYtNDJiYS04MGRlLTM0ZDE1YzJmNWE2YyIsImlhdCI6MTc2MzQ5MDcxMywiZXhwIjoxNzYzNTc3MTEzfQ.h8ta-4tVhR7EskZDBLtcFTQ7QllV-PfC09Y0DLjYJa4
|
|
||||||
}
|
|
||||||
|
|
||||||
body:json {
|
|
||||||
{
|
|
||||||
"userId": "9c913747-ba57-4b12-87d0-3339f4a8117c",
|
|
||||||
"password": "test"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
settings {
|
|
||||||
encodeUrl: true
|
|
||||||
}
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
||||||
meta {
|
|
||||||
name: createUser
|
|
||||||
type: http
|
|
||||||
seq: 1
|
|
||||||
}
|
|
||||||
|
|
||||||
post {
|
|
||||||
url: http://localhost:4000/user/create
|
|
||||||
body: json
|
|
||||||
auth: bearer
|
|
||||||
}
|
|
||||||
|
|
||||||
auth:bearer {
|
|
||||||
token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImE0NDdlNDM0LTQyMWYtNDJiYS04MGRlLTM0ZDE1YzJmNWE2YyIsImlhdCI6MTc2MzQ5MDcxMywiZXhwIjoxNzYzNTc3MTEzfQ.h8ta-4tVhR7EskZDBLtcFTQ7QllV-PfC09Y0DLjYJa4
|
|
||||||
}
|
|
||||||
|
|
||||||
body:json {
|
|
||||||
{
|
|
||||||
"userData": {
|
|
||||||
"userName": "test3",
|
|
||||||
"email": "test@raemer.net"
|
|
||||||
},
|
|
||||||
"password": "test"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
settings {
|
|
||||||
encodeUrl: true
|
|
||||||
}
|
|
||||||
10
bruno/recipe-backend/environments/dev - admin.bru
Normal file
10
bruno/recipe-backend/environments/dev - admin.bru
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
vars {
|
||||||
|
url: http://localhost:4000
|
||||||
|
username: admin
|
||||||
|
tokenExpireDate:
|
||||||
|
blocked: false
|
||||||
|
}
|
||||||
|
vars:secret [
|
||||||
|
token,
|
||||||
|
password
|
||||||
|
]
|
||||||
10
bruno/recipe-backend/environments/dev - user.bru
Normal file
10
bruno/recipe-backend/environments/dev - user.bru
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
vars {
|
||||||
|
url: http://localhost:4000
|
||||||
|
username: bruno
|
||||||
|
tokenExpireDate:
|
||||||
|
blocked: false
|
||||||
|
}
|
||||||
|
vars:secret [
|
||||||
|
password,
|
||||||
|
token
|
||||||
|
]
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
meta {
|
|
||||||
name: getAllUsers
|
|
||||||
type: http
|
|
||||||
seq: 10
|
|
||||||
}
|
|
||||||
|
|
||||||
get {
|
|
||||||
url: http://localhost:4000/user/all
|
|
||||||
body: none
|
|
||||||
auth: bearer
|
|
||||||
}
|
|
||||||
|
|
||||||
auth:bearer {
|
|
||||||
token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImE0NDdlNDM0LTQyMWYtNDJiYS04MGRlLTM0ZDE1YzJmNWE2YyIsImlhdCI6MTc2MzMyMDEzMywiZXhwIjoxNzYzNDA2NTMzfQ.tguHEC4VFZJkbWjnI628VwuIB_p9odtBIPANcabH8q4
|
|
||||||
}
|
|
||||||
|
|
||||||
settings {
|
|
||||||
encodeUrl: true
|
|
||||||
}
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
meta {
|
|
||||||
name: getCompactRecipes
|
|
||||||
type: http
|
|
||||||
seq: 5
|
|
||||||
}
|
|
||||||
|
|
||||||
get {
|
|
||||||
url: http://localhost:4000/compact-recipe
|
|
||||||
body: none
|
|
||||||
auth: bearer
|
|
||||||
}
|
|
||||||
|
|
||||||
auth:bearer {
|
|
||||||
token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImE0NDdlNDM0LTQyMWYtNDJiYS04MGRlLTM0ZDE1YzJmNWE2YyIsImlhdCI6MTc1OTA3NjA2NCwiZXhwIjoxNzU5MTYyNDY0fQ.exf_3fCrarW0LhUqPuadvp89BOUazEXtdSTkGDIAU_Q
|
|
||||||
}
|
|
||||||
|
|
||||||
settings {
|
|
||||||
encodeUrl: true
|
|
||||||
}
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
meta {
|
|
||||||
name: login
|
|
||||||
type: http
|
|
||||||
seq: 2
|
|
||||||
}
|
|
||||||
|
|
||||||
post {
|
|
||||||
url: http://localhost:4000/auth/login
|
|
||||||
body: json
|
|
||||||
auth: inherit
|
|
||||||
}
|
|
||||||
|
|
||||||
body:json {
|
|
||||||
{
|
|
||||||
"userName": "admin",
|
|
||||||
"password": "1J7HgWRZ2OfaiFgrKb1BULIXN"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
settings {
|
|
||||||
encodeUrl: true
|
|
||||||
}
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
meta {
|
|
||||||
name: me
|
|
||||||
type: http
|
|
||||||
seq: 3
|
|
||||||
}
|
|
||||||
|
|
||||||
get {
|
|
||||||
url: http://localhost:4000/user/me
|
|
||||||
body: none
|
|
||||||
auth: bearer
|
|
||||||
}
|
|
||||||
|
|
||||||
auth:bearer {
|
|
||||||
token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImE0NDdlNDM0LTQyMWYtNDJiYS04MGRlLTM0ZDE1YzJmNWE2YyIsImlhdCI6MTc2MzQ5MDcxMywiZXhwIjoxNzYzNTc3MTEzfQ.h8ta-4tVhR7EskZDBLtcFTQ7QllV-PfC09Y0DLjYJa4
|
|
||||||
}
|
|
||||||
|
|
||||||
settings {
|
|
||||||
encodeUrl: true
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue