Skip to content

Commit

Permalink
tests: add bruno conformance tests
Browse files Browse the repository at this point in the history
  • Loading branch information
emmanuelgautier committed Mar 11, 2024
1 parent 358d7f3 commit e671441
Show file tree
Hide file tree
Showing 8 changed files with 120 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/conformance/Authorize/Authorize.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
meta {
name: Authorize
type: http
seq: 1
}

get {
url: {{host}}/oauth/authorize
}

assert {
res.status: eq 307
res.body: isEmpty
res.headers.location: isDefined
res.headers.location: eq {{authServerUrl}}/oauth/authorize
}

script:pre-request {
req.setMaxRedirects(0);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
meta {
name: Authorize Callback Without Query Params
type: http
seq: 1
}

get {
url: {{host}}/oauth/callback
}

assert {
res.status: eq 400
res.headers.location: undefined
}
20 changes: 20 additions & 0 deletions tests/conformance/Authorize/Callback/Authorize Callback.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
meta {
name: Authorize Callback
type: http
seq: 1
}

get {
url: {{host}}/oauth/callback
}

assert {
res.status: eq 301
res.body: isEmpty
res.headers.location: isDefined
res.headers.location: eq /
}

script:pre-request {
req.setMaxRedirects(0);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
meta {
name: Get Sessions When Set Cookie
type: http
seq: 2
}

get {
url: {{host}}/sessions
body: none
auth: none
}

headers {
Cookie: jwt=test
}

assert {
res.status: eq 200
res.body: isJson
res.body.sessions: length 0
}
17 changes: 17 additions & 0 deletions tests/conformance/Sessions/Get Sessions/Get Sessions.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
meta {
name: Get Sessions
type: http
seq: 1
}

get {
url: {{host}}/sessions
body: none
auth: none
}

assert {
res.status: eq 200
res.body: isJson
res.body.sessions: length 0
}
16 changes: 16 additions & 0 deletions tests/conformance/Sessions/Has Session.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
meta {
name: Has Session
type: http
seq: 1
}

head {
url: {{host}}/sessions
body: none
auth: none
}

assert {
res.status: eq 204
res.body: isEmpty
}
8 changes: 8 additions & 0 deletions tests/conformance/bruno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"version": "1",
"name": "baffao",
"type": "collection",
"ignore": [
"node_modules"
]
}
4 changes: 4 additions & 0 deletions tests/conformance/environments/local.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
vars {
host: http://localhost:3000
authServerUrl: http://localhost:8080
}

0 comments on commit e671441

Please sign in to comment.