Skip to content

Commit

Permalink
Return wqx3 test
Browse files Browse the repository at this point in the history
  • Loading branch information
thodson-usgs committed Sep 17, 2024
1 parent ef09e3d commit 40a2b46
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion tests/wqp_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
)


def test_get_ratings(requests_mock):
def test_get_results(requests_mock):
"""Tests water quality portal ratings query"""
request_url = "https://www.waterqualitydata.us/data/Result/Search?siteid=WIDNR_WQX-10032762" \
"&characteristicName=Specific+conductance&startDateLo=05-01-2011&startDateHi=09-30-2011" \
Expand All @@ -36,6 +36,25 @@ def test_get_ratings(requests_mock):
assert md.comment is None


def test_get_results_WQX3(requests_mock):
"""Tests water quality portal results query with new WQX3.0 profile"""
request_url = "https://www.waterqualitydata.us/wqx3/Result/search?siteid=WIDNR_WQX-10032762" \
"&characteristicName=Specific+conductance&startDateLo=05-01-2011&startDateHi=09-30-2011" \
"&mimeType=csv" \
"&dataProfile=fullPhysChem"
response_file_path = 'data/wqp3_results.txt'
mock_request(requests_mock, request_url, response_file_path)
df, md = get_results(legacy=False, siteid='WIDNR_WQX-10032762',
characteristicName = 'Specific conductance',
startDateLo='05-01-2011', startDateHi='09-30-2011')
assert type(df) is DataFrame
assert df.size == 900
assert md.url == request_url
assert isinstance(md.query_time, datetime.timedelta)
assert md.header == {"mock_header": "value"}
assert md.comment is None


def test_what_sites(requests_mock):
"""Tests Water quality portal sites query"""
request_url = "https://www.waterqualitydata.us/data/Station/Search?statecode=US%3A34&characteristicName=Chloride" \
Expand Down

0 comments on commit 40a2b46

Please sign in to comment.