-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding role permissions to HFI (#1947)
Permissions functional for the following roles - Role for editing fire starts - Role for selecting stations - Role for change fuel type
- Loading branch information
Showing
41 changed files
with
1,372 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ on: | |
pull_request: | ||
branches: | ||
- main | ||
- roles | ||
|
||
jobs: | ||
prepare-dev-database: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ on: | |
pull_request: | ||
branches: | ||
- main | ||
- roles | ||
|
||
jobs: | ||
set-description: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,67 @@ | ||
Feature: /hfi/ | ||
|
||
Scenario: HFI - request | ||
Scenario: HFI - GET request | ||
Given I have a stored request <stored_request_json> | ||
And I spy on store_hfi_request | ||
And I received a hfi-calc <url> with <verb> | ||
And I received a GET request for hfi-calc <url> | ||
Then the response status code is <status_code> | ||
And the response is <response_json> | ||
And the response isn't cached | ||
And request == saved = <request_saved> | ||
|
||
Examples: | ||
| url | verb | status_code | response_json | request_saved | stored_request_json | | ||
| /api/hfi-calc/fire_centre/1 | get | 200 | hfi/test_hfi_endpoint_load_response.json | False | None | | ||
| /api/hfi-calc/fire_centre/1 | get | 200 | hfi/test_hfi_endpoint_load_response.json | False | test_hfi_endpoint_stored_request.json | | ||
| /api/hfi-calc/fire_centre/1/2020-05-21/2020-05-25 | get | 200 | hfi/test_hfi_endpoint_load_response.json | False | None | | ||
| /api/hfi-calc/fire_centre/1/2020-05-21/2020-05-25 | get | 200 | hfi/test_hfi_endpoint_load_response.json | False | test_hfi_endpoint_stored_request.json | | ||
# Test set fire start range | ||
| /api/hfi-calc/fire_centre/1/2020-05-21/2020-05-25/planning_area/1/fire_starts/2020-05-21/fire_start_range/2 | post | 200 | hfi/test_hfi_endpoint_response_set_fire_start_range.json | True | None | | ||
| /api/hfi-calc/fire_centre/1/2020-05-21/2020-05-25/planning_area/1/fire_starts/2020-05-21/fire_start_range/2 | post | 200 | hfi/test_hfi_endpoint_response_set_fire_start_range.json | True | test_hfi_endpoint_stored_request.json | | ||
# Test the station selection. | ||
| /api/hfi-calc/fire_centre/1/2020-05-21/2020-05-25/planning_area/1/station/230/selected/false | post | 200 | hfi/test_hfi_endpoint_response_deselect_station.json | True | None | | ||
| /api/hfi-calc/fire_centre/1/2020-05-21/2020-05-25/planning_area/1/station/230/selected/false | post | 200 | hfi/test_hfi_endpoint_response_deselect_station.json | True | test_hfi_endpoint_stored_request.json | | ||
| /api/hfi-calc/fire_centre/1/2020-05-21/2020-05-25/planning_area/1/station/230/selected/true | post | 200 | hfi/test_hfi_endpoint_response_select_station.json | True | None | | ||
| /api/hfi-calc/fire_centre/1/2020-05-21/2020-05-25/planning_area/1/station/230/selected/true | post | 200 | hfi/test_hfi_endpoint_response_select_station.json | True | test_hfi_endpoint_stored_request.json | | ||
# Test set the station fuel type. | ||
| /api/hfi-calc/fire_centre/1/2020-05-21/2020-05-25/planning_area/1/station/230/fuel_type/2 | post | 200 | hfi/test_hfi_endpoint_response_set_fuel_type.json | True | None | | ||
| /api/hfi-calc/fire_centre/1/2020-05-21/2020-05-25/planning_area/1/station/230/fuel_type/2 | post | 200 | hfi/test_hfi_endpoint_response_set_fuel_type.json | True | test_hfi_endpoint_stored_request.json | | ||
# Invalid fuel type should return 500 error, and not be saved. | ||
| /api/hfi-calc/fire_centre/1/2020-05-21/2020-05-25/planning_area/1/station/230/fuel_type/-1 | post | 500 | None | False | None | | ||
| url | status_code | response_json | request_saved | stored_request_json | | ||
| /api/hfi-calc/fire_centre/1 | 200 | hfi/test_hfi_endpoint_load_response.json | False | None | | ||
| /api/hfi-calc/fire_centre/1 | 200 | hfi/test_hfi_endpoint_load_response.json | False | test_hfi_endpoint_stored_request.json | | ||
| /api/hfi-calc/fire_centre/1/2020-05-21/2020-05-25 | 200 | hfi/test_hfi_endpoint_load_response.json | False | None | | ||
| /api/hfi-calc/fire_centre/1/2020-05-21/2020-05-25 | 200 | hfi/test_hfi_endpoint_load_response.json | False | test_hfi_endpoint_stored_request.json | | ||
|
||
|
||
| api/hfi-calc/fire_centre/1/2020-05-21/2020-05-25/pdf | get | 200 | None | False | None | | ||
| api/hfi-calc/fire_centre/1/2020-05-21/2020-05-25/pdf | get | 200 | None | False | test_hfi_endpoint_stored_request.json | | ||
| api/hfi-calc/fire_centre/1/2020-05-21/2020-05-25/pdf | 200 | None | False | None | | ||
| api/hfi-calc/fire_centre/1/2020-05-21/2020-05-25/pdf | 200 | None | False | test_hfi_endpoint_stored_request.json | | ||
|
||
|
||
Scenario: HFI - POST request | ||
Given I have a stored request <stored_request_json> | ||
And I spy on store_hfi_request | ||
And I received a POST request for hfi-calc <url> with <role> | ||
Then the response status code is <status_code> | ||
And the response is <response_json> | ||
And the response isn't cached | ||
And request == saved = <request_saved> | ||
|
||
Examples: | ||
| url | role | status_code | response_json | request_saved | stored_request_json | | ||
# Test set fire start range with correct role | ||
| /api/hfi-calc/fire_centre/1/2020-05-21/2020-05-25/planning_area/1/fire_starts/2020-05-21/fire_start_range/2 | hfi_set_fire_starts | 200 | hfi/test_hfi_endpoint_response_set_fire_start_range.json | True | None | | ||
| /api/hfi-calc/fire_centre/1/2020-05-21/2020-05-25/planning_area/1/fire_starts/2020-05-21/fire_start_range/2 | hfi_set_fire_starts | 200 | hfi/test_hfi_endpoint_response_set_fire_start_range.json | True | test_hfi_endpoint_stored_request.json | | ||
# Test set fire start range without roles | ||
| /api/hfi-calc/fire_centre/1/2020-05-21/2020-05-25/planning_area/1/fire_starts/2020-05-21/fire_start_range/2 | None | 401 | None | False | None | | ||
| /api/hfi-calc/fire_centre/1/2020-05-21/2020-05-25/planning_area/1/fire_starts/2020-05-21/fire_start_range/2 | None | 401 | None | False | test_hfi_endpoint_stored_request.json | | ||
# Test set fire start range without correct role | ||
| /api/hfi-calc/fire_centre/1/2020-05-21/2020-05-25/planning_area/1/fire_starts/2020-05-21/fire_start_range/2 | hfi_select_station | 401 | None | False | None | | ||
| /api/hfi-calc/fire_centre/1/2020-05-21/2020-05-25/planning_area/1/fire_starts/2020-05-21/fire_start_range/2 | hfi_select_station | 401 | None | False | test_hfi_endpoint_stored_request.json | | ||
# Test the station selection with correct role | ||
| /api/hfi-calc/fire_centre/1/2020-05-21/2020-05-25/planning_area/1/station/230/selected/false | hfi_select_station | 200 | hfi/test_hfi_endpoint_response_deselect_station.json | True | None | | ||
| /api/hfi-calc/fire_centre/1/2020-05-21/2020-05-25/planning_area/1/station/230/selected/false | hfi_select_station | 200 | hfi/test_hfi_endpoint_response_deselect_station.json | True | test_hfi_endpoint_stored_request.json | | ||
| /api/hfi-calc/fire_centre/1/2020-05-21/2020-05-25/planning_area/1/station/230/selected/true | hfi_select_station | 200 | hfi/test_hfi_endpoint_response_select_station.json | True | None | | ||
| /api/hfi-calc/fire_centre/1/2020-05-21/2020-05-25/planning_area/1/station/230/selected/true | hfi_select_station | 200 | hfi/test_hfi_endpoint_response_select_station.json | True | test_hfi_endpoint_stored_request.json | | ||
# Test the station selection without roles | ||
| /api/hfi-calc/fire_centre/1/2020-05-21/2020-05-25/planning_area/1/station/230/selected/false | None | 401 | None | False | None | | ||
| /api/hfi-calc/fire_centre/1/2020-05-21/2020-05-25/planning_area/1/station/230/selected/false | None | 401 | None | False | test_hfi_endpoint_stored_request.json | | ||
| /api/hfi-calc/fire_centre/1/2020-05-21/2020-05-25/planning_area/1/station/230/selected/true | None | 401 | None | False | None | | ||
| /api/hfi-calc/fire_centre/1/2020-05-21/2020-05-25/planning_area/1/station/230/selected/true | None | 401 | None | False | test_hfi_endpoint_stored_request.json | | ||
# Test the station selection without correct role | ||
| /api/hfi-calc/fire_centre/1/2020-05-21/2020-05-25/planning_area/1/station/230/selected/false | hfi_set_fire_starts | 401 | None | False | None | | ||
| /api/hfi-calc/fire_centre/1/2020-05-21/2020-05-25/planning_area/1/station/230/selected/false | hfi_set_fire_starts | 401 | None | False | test_hfi_endpoint_stored_request.json | | ||
| /api/hfi-calc/fire_centre/1/2020-05-21/2020-05-25/planning_area/1/station/230/selected/true | hfi_set_fire_starts | 401 | None | False | None | | ||
| /api/hfi-calc/fire_centre/1/2020-05-21/2020-05-25/planning_area/1/station/230/selected/true | hfi_set_fire_starts | 401 | None | False | test_hfi_endpoint_stored_request.json | | ||
# Test set the station fuel type with correct role | ||
| /api/hfi-calc/fire_centre/1/2020-05-21/2020-05-25/planning_area/1/station/230/fuel_type/2 | hfi_set_fuel_type | 200 | hfi/test_hfi_endpoint_response_set_fuel_type.json | True | None | | ||
| /api/hfi-calc/fire_centre/1/2020-05-21/2020-05-25/planning_area/1/station/230/fuel_type/2 | hfi_set_fuel_type | 200 | hfi/test_hfi_endpoint_response_set_fuel_type.json | True | test_hfi_endpoint_stored_request.json | | ||
# Test set the station fuel type without correct role | ||
| /api/hfi-calc/fire_centre/1/2020-05-21/2020-05-25/planning_area/1/station/230/fuel_type/2 | None | 401 | None | False | None | | ||
| /api/hfi-calc/fire_centre/1/2020-05-21/2020-05-25/planning_area/1/station/230/fuel_type/2 | None | 401 | None | False | test_hfi_endpoint_stored_request.json | | ||
# Invalid fuel type should return 500 error, and not be saved. | ||
| /api/hfi-calc/fire_centre/1/2020-05-21/2020-05-25/planning_area/1/station/230/fuel_type/-1 | hfi_set_fuel_type | 500 | None | False | None | |
Oops, something went wrong.