-
Notifications
You must be signed in to change notification settings - Fork 86
Expand file tree
/
Copy pathauthorized_noop_token.feature
More file actions
67 lines (60 loc) · 3.18 KB
/
authorized_noop_token.feature
File metadata and controls
67 lines (60 loc) · 3.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
@Authorized
Feature: Authorized endpoint API tests for the noop-with-token authentication module
Background:
Given The service is started locally
And REST API service prefix is /v1
Scenario: Check if the authorized endpoint fails when user_id and auth header are not provided
Given The system is in default state
When I access endpoint "authorized" using HTTP POST method
"""
{"placeholder":"abc"}
"""
Then The status code of the response is 401
And The body of the response is the following
"""
{"detail": "No Authorization header found"}
"""
Scenario: Check if the authorized endpoint works when user_id is not provided
Given The system is in default state
And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva
When I access endpoint "authorized" using HTTP POST method without user_id
Then The status code of the response is 200
And The body of the response is the following
"""
{"user_id": "00000000-0000-0000-0000-000","username": "lightspeed-user","skip_userid_check": true}
"""
Scenario: Check if the authorized endpoint works when providing empty user_id
Given The system is in default state
And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva
When I access endpoint "authorized" using HTTP POST method with user_id ""
Then The status code of the response is 200
And The body of the response is the following
"""
{"user_id": "","username": "lightspeed-user","skip_userid_check": true}
"""
Scenario: Check if the authorized endpoint works when providing proper user_id
Given The system is in default state
And I set the Authorization header to Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva
When I access endpoint "authorized" using HTTP POST method with user_id "test_user"
Then The status code of the response is 200
And The body of the response is the following
"""
{"user_id": "test_user","username": "lightspeed-user","skip_userid_check": true}
"""
Scenario: Check if the authorized endpoint works with proper user_id but bearer token is not present
Given The system is in default state
When I access endpoint "authorized" using HTTP POST method with user_id "test_user"
Then The status code of the response is 400
And The body of the response is the following
"""
{"detail": "No Authorization header found"}
"""
Scenario: Check if the authorized endpoint works when auth token is malformed
Given The system is in default state
And I set the Authorization header to BearereyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ikpva
When I access endpoint "authorized" using HTTP POST method with user_id "test_user"
Then The status code of the response is 400
And The body of the response is the following
"""
{"detail": "No token found in Authorization header"}
"""