-
Notifications
You must be signed in to change notification settings - Fork 4
BDMS 227: well additional information tests #237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
0ac45c1
WIP: first stab at well additional information
jacob-a-brown 466055b
Merge branch 'staging' into bdms-227-jab-bdms-229
jacob-a-brown edf3c38
WIP: well additional information bdd tests
jacob-a-brown 7197ede
feat: use function to retrieve polymoprhic records
jacob-a-brown 7e6f9a1
Merge branch 'bdms-227' into bdms-227-jab-bdms-229
jacob-a-brown 7d37154
refactor: test for casing materials
jacob-a-brown c0b80fb
fix: fix casing materials test
jacob-a-brown 878ef3b
fix: uncomment pytest from pre commit
jacob-a-brown File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,206 @@ | ||
| from behave import when, then | ||
|
|
||
| from services.util import retrieve_polymorphic_table_record | ||
|
|
||
|
|
||
| @when("the user retrieves the well by ID via path parameter") | ||
| def step_impl_retrieve_well_by_id(context): | ||
| context.well = context.objects["wells"][0] | ||
| context.response = context.client.get(f"/thing/water-well/{context.well.id}") | ||
| context.data = context.response.json() | ||
|
|
||
|
|
||
| # ------------------------------------------------------------------------------ | ||
| # Permissions / Operational OK flags | ||
| # ------------------------------------------------------------------------------ | ||
| # TODO: the API needs to be updated to include Permissions | ||
| # TODO: the schema and test data need to be updated | ||
| # TODO: should the testing data and tests contain multiple permissions, one that has expired? | ||
| # TODO: what are the permission_types that will be used? after they have been determined update these tests | ||
|
|
||
|
|
||
| @then( | ||
| "the response should include whether repeat measurement permission is granted for the well" | ||
| ) | ||
| def step_impl(context): | ||
| assert "permissions" in context.data | ||
|
|
||
| permission_record = retrieve_polymorphic_table_record( | ||
| context.well, "permissions", "allow_water_level_measurements", latest=True | ||
| ) | ||
|
|
||
| assert ( | ||
| context.data["permissions"]["allow_water_level_measurements"] | ||
| == permission_record.permission_allowed | ||
| ) | ||
|
|
||
|
|
||
| @then("the response should include whether sampling permission is granted for the well") | ||
| def step_impl(context): | ||
| assert "permissions" in context.data | ||
|
|
||
| permission_record = retrieve_polymorphic_table_record( | ||
| context.well, "permissions", "allow_water_chemistry_sample", latest=True | ||
| ) | ||
|
|
||
| assert ( | ||
| context.data["permissions"]["allow_sampling"] | ||
| == permission_record.permission_allowed | ||
| ) | ||
|
|
||
|
|
||
| # TODO: should this be datalogger specific? | ||
| @then( | ||
| "the response should include whether datalogger installation permission is granted for the well" | ||
| ) | ||
| def step_impl(context): | ||
| assert "permissions" in context.data | ||
|
|
||
| permission_record = retrieve_polymorphic_table_record( | ||
| context.well, "permissions", "allow_data_logger_installation", latest=True | ||
| ) | ||
|
|
||
| assert ( | ||
| context.data["permissions"]["allow_data_logger_installation"] | ||
| == permission_record.permission_allowed | ||
| ) | ||
|
|
||
|
|
||
| # ------------------------------------------------------------------------------ | ||
| # Well Construction Information | ||
| # ------------------------------------------------------------------------------ | ||
|
|
||
|
|
||
| # TODO: needs to be added to model, schemas, test data | ||
| @then("the response should include the completion date of the well") | ||
| def step_impl(context): | ||
| assert "completion_date" in context.data | ||
| assert context.data["completion_date"] == context.well.completion_date.strftime( | ||
| "%Y-%m-%d" | ||
| ) | ||
|
|
||
|
|
||
| # TODO: needs to be added to model, schemas, test data | ||
| @then("the response should include the source of the completion information") | ||
| def step_impl(context): | ||
| assert "completion_info_source" in context.data | ||
| assert context.data["completion_info_source"] == context.well.completion_info_source | ||
|
|
||
|
|
||
| # TODO: needs to be added to model, schemas, test data | ||
| @then("the response should include the driller name") | ||
| def step_impl(context): | ||
| assert "driller_name" in context.data | ||
| assert context.data["driller_name"] == context.well.driller_name | ||
|
|
||
|
|
||
| # TODO: needs to be added to model, schemas, test data | ||
| # TODO: needs to be an enum and added to lexicon | ||
| @then("the response should include the construction method") | ||
| def step_impl(context): | ||
| assert "construction_method" in context.data | ||
| assert context.data["construction_method"] == context.well.construction_method | ||
|
|
||
|
|
||
| # TODO: needs to be added to model, schemas, test data | ||
| @then("the response should include the source of the construction information") | ||
| def step_impl(context): | ||
| assert "construction_info_source" in context.data | ||
| assert ( | ||
| context.data["construction_info_source"] | ||
| == context.well.construction_info_source | ||
| ) | ||
|
|
||
|
|
||
| # ------------------------------------------------------------------------------ | ||
| # Additional Well Physical Properties | ||
| # ------------------------------------------------------------------------------ | ||
|
|
||
|
|
||
| # TODO: the transfer script needs to convert ft to in | ||
| @then("the response should include the casing diameter in inches") | ||
| def step_impl(context): | ||
| assert "casing_diameter" in context.data | ||
| assert "casing_diameter_unit" in context.data | ||
|
|
||
| assert context.data["casing_diameter"] == context.well.casing_diameter | ||
| assert context.data["casing_diameter_unit"] == "in" | ||
|
|
||
|
|
||
| @then("the response should include the casing depth in feet below ground surface") | ||
| def step_impl(context): | ||
| assert "well_casing_depth" in context.data | ||
| assert "well_casing_depth_unit" in context.data | ||
|
|
||
| assert context.data["well_casing_depth"] == context.well.well_casing_depth | ||
| assert context.data["well_casing_depth_unit"] == "ft" | ||
|
|
||
|
|
||
| # TODO: needs to be added to model, schemas, test data | ||
| @then("the response should include the casing materials") | ||
| def step_impl(context): | ||
| assert "well_casing_materials" in context.data | ||
| assert sorted(context.data["well_casing_materials"]) == sorted( | ||
| [m.material for m in context.well.well_casing_materials] | ||
| ) | ||
|
|
||
|
|
||
| # TODO: needs to be added to model, schemas, test data | ||
| # TODO: needs to be added to lexicon and an enum should be created | ||
| @then("the response should include the well pump type (previously well_type field)") | ||
| def step_impl(context): | ||
| assert "well_pump_type" in context.data | ||
| assert context.data["well_pump_type"] == context.well.well_pump_type | ||
|
|
||
|
|
||
| # TODO: needs to be added to model, schemas, test data | ||
| @then("the response should include the well pump depth in feet (new field)") | ||
| def step_impl(context): | ||
| assert "well_pump_depth" in context.data | ||
| assert "well_pump_depth_unit" in context.data | ||
|
|
||
| assert context.data["well_pump_depth"] == context.well.well_pump_depth | ||
| assert context.data["well_pump_depth_unit"] == "ft" | ||
|
|
||
|
|
||
| # TODO: needs to be added to model, schemas, test data | ||
| @then( | ||
| "the response should include whether the well is open and suitable for a datalogger" | ||
| ) | ||
| def step_impl(context): | ||
| data = context.response.json() | ||
| assert data["well_open"] is True | ||
| assert data["well_suitable_for_datalogger"] is True | ||
|
|
||
|
|
||
| # ------------------------------------------------------------------------------ | ||
| # Aquifer/ Geology Information | ||
| # ------------------------------------------------------------------------------ | ||
|
|
||
|
|
||
| # TODO: needs to be added to model, schemas, test data | ||
| @then( | ||
| "the response should include the formation as the formation zone of well completion" | ||
| ) | ||
| def step_impl(context): | ||
| assert "formation" in context.data | ||
| assert context.data["formation"] == context.well.formation | ||
|
|
||
|
|
||
| # TODO: needs to be added to model, schemas, test data, lexicon | ||
| @then( | ||
| "the response should include the aquifer class code to classify the aquifer into aquifer system." | ||
| ) | ||
| def step_impl(context): | ||
| assert "aquifer_class_code" in context.data | ||
| assert context.data["aquifer_class_code"] == context.well.aquifer_class_code | ||
|
|
||
|
|
||
| # TODO: needs to be added to model, schemas, test data | ||
| # TODO: should this be plural? that is, a descriptor model of the well | ||
| @then( | ||
| "the response should include the aquifer type as the type of aquifers penetrated by the well" | ||
| ) | ||
| def step_impl(context): | ||
| assert "aquifer_type" in context.data | ||
| assert context.data["aquifer_type"] == context.well.aquifer_type | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.