Skip to content

Commit

Permalink
improved component tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aryan-p03 committed Jan 31, 2025
1 parent f4cd944 commit b9c74cc
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 17 deletions.
11 changes: 7 additions & 4 deletions features/dimensions.feature
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ Feature: Dataset API

Scenario: GET /datasets/{id}/editions/{edition}/versions/{version}/dimensions in public mode
And URL rewriting is enabled
When I GET "/datasets/population-estimates/editions/hello/versions/1/dimensions" without a request host
And I set the "X-Forwarded-Proto" header to "https"
And I set the "X-Forwarded-Host" header to "api.example.com"
And I set the "X-Forwarded-Path-Prefix" header to "v1"
When I GET "/datasets/population-estimates/editions/hello/versions/1/dimensions"
Then I should receive the following JSON response with status "200":
"""
{
Expand All @@ -101,11 +104,11 @@ Feature: Dataset API
"links": {
"code_list": {},
"options": {
"href": "http://localhost:22000/datasets/population-estimates/editions/hello/versions/dimensions/geography/options",
"href": "https://api.example.com/v1/datasets/population-estimates/editions/hello/versions/dimensions/geography/options",
"id": "geography"
},
"version": {
"href": "http://localhost:22000/datasets/population-estimates/editions/hello/versions/"
"href": "https://api.example.com/v1/datasets/population-estimates/editions/hello/versions/"
}
}
}
Expand Down Expand Up @@ -163,7 +166,7 @@ Feature: Dataset API
"""

Scenario: GET /datasets/{id}/editions/{edition}/versions/{version}/dimensions/{dimension}/options in public mode
When I GET "/datasets/population-estimates/editions/hello/versions/1/dimensions/geography/options" without a request host
When I GET "/datasets/population-estimates/editions/hello/versions/1/dimensions/geography/options"
Then I should receive the following JSON response with status "200":
"""
{
Expand Down
10 changes: 8 additions & 2 deletions features/instance_dimensions.feature
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,10 @@ Feature: Dataset API
Given private endpoints are enabled
And I am identified as "[email protected]"
And I am authorised
When I GET "/instances/test-item-1/dimensions" without a request host
And I set the "X-Forwarded-Proto" header to "https"
And I set the "X-Forwarded-Host" header to "api.example.com"
And I set the "X-Forwarded-Path-Prefix" header to "v1"
When I GET "/instances/test-item-1/dimensions"
Then I should receive the following JSON response with status "200":
"""
{
Expand Down Expand Up @@ -203,7 +206,10 @@ Feature: Dataset API
Given private endpoints are enabled
And I am identified as "[email protected]"
And I am authorised
When I GET "/instances/test-item-1/dimensions?offset=3&limit=7" without a request host
And I set the "X-Forwarded-Proto" header to "https"
And I set the "X-Forwarded-Host" header to "api.example.com"
And I set the "X-Forwarded-Path-Prefix" header to "v1"
When I GET "/instances/test-item-1/dimensions?offset=3&limit=7"
Then I should receive the following JSON response with status "200":
"""
{
Expand Down
34 changes: 23 additions & 11 deletions features/versions.feature
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,10 @@ Feature: Dataset API

Scenario: GET /datasets/{id}/editions/{edition}/versions in public mode returns published versions
And URL rewriting is enabled
When I GET "/datasets/population-estimates/editions/hello/versions" without a request host
And I set the "X-Forwarded-Proto" header to "https"
And I set the "X-Forwarded-Host" header to "api.example.com"
And I set the "X-Forwarded-Path-Prefix" header to "v1"
When I GET "/datasets/population-estimates/editions/hello/versions"
Then I should receive the following JSON response with status "200":
"""
{
Expand All @@ -246,7 +249,7 @@ Feature: Dataset API
"id": "population-estimates"
},
"self": {
"href": "http://localhost:22000/someurl"
"href": "https://api.example.com/v1/someurl"
}
},
"lowest_geography": "ltla"
Expand All @@ -262,7 +265,7 @@ Feature: Dataset API
"id": "population-estimates"
},
"self": {
"href": "http://localhost:22000/someurl"
"href": "https://api.example.com/v1/someurl"
}
}
}
Expand Down Expand Up @@ -321,9 +324,12 @@ Feature: Dataset API
Scenario: GET /datasets/{id}/editions/{edition}/versions in private mode returns all versions
Given private endpoints are enabled
And URL rewriting is enabled
And I set the "X-Forwarded-Proto" header to "https"
And I set the "X-Forwarded-Host" header to "api.example.com"
And I set the "X-Forwarded-Path-Prefix" header to "v1"
And I am identified as "[email protected]"
And I am authorised
When I GET "/datasets/population-estimates/editions/hello/versions" without a request host
When I GET "/datasets/population-estimates/editions/hello/versions"
Then I should receive the following JSON response with status "200":
"""
{
Expand All @@ -339,7 +345,7 @@ Feature: Dataset API
"id": "population-estimates"
},
"self": {
"href": "http://localhost:22000/someurl"
"href": "https://api.example.com/v1/someurl"
}
},
"edition": "hello",
Expand All @@ -355,7 +361,7 @@ Feature: Dataset API
"id": "population-estimates"
},
"self": {
"href": "http://localhost:22000/someurl"
"href": "https://api.example.com/v1/someurl"
}
},
"edition": "hello"
Expand All @@ -370,7 +376,7 @@ Feature: Dataset API
"id": "population-estimates"
},
"self": {
"href": "http://localhost:22000/someurl"
"href": "https://api.example.com/v1/someurl"
}
},
"edition": "hello"
Expand Down Expand Up @@ -471,7 +477,10 @@ Feature: Dataset API

Scenario: GET /datasets/{id}/editions/{edition}/versions/{version} in public mode returns the version
And URL rewriting is enabled
When I GET "/datasets/population-estimates/editions/hello/versions/4" without a request host
And I set the "X-Forwarded-Proto" header to "https"
And I set the "X-Forwarded-Host" header to "api.example.com"
And I set the "X-Forwarded-Path-Prefix" header to "v1"
When I GET "/datasets/population-estimates/editions/hello/versions/4"
Then I should receive the following JSON response with status "200":
"""
{
Expand All @@ -483,7 +492,7 @@ Feature: Dataset API
"id": "population-estimates"
},
"self": {
"href": "http://localhost:22000/someurl"
"href": "https://api.example.com/v1/someurl"
}
},
"edition": "hello",
Expand Down Expand Up @@ -517,9 +526,12 @@ Feature: Dataset API
Scenario: GET /datasets/{id}/editions/{edition}/versions/{version} in private mode returns the version
Given private endpoints are enabled
And URL rewriting is enabled
And I set the "X-Forwarded-Proto" header to "https"
And I set the "X-Forwarded-Host" header to "api.example.com"
And I set the "X-Forwarded-Path-Prefix" header to "v1"
And I am identified as "[email protected]"
And I am authorised
When I GET "/datasets/population-estimates/editions/hello/versions/2" without a request host
When I GET "/datasets/population-estimates/editions/hello/versions/2"
Then I should receive the following JSON response with status "200":
"""
{
Expand All @@ -531,7 +543,7 @@ Feature: Dataset API
"id": "population-estimates"
},
"self": {
"href": "http://localhost:22000/someurl"
"href": "https://api.example.com/v1/someurl"
}
},
"edition": "hello"
Expand Down

0 comments on commit b9c74cc

Please sign in to comment.