ropensci / wateRinfo

R package to download time series data from waterinfo.be
https://docs.ropensci.org/wateRinfo
MIT License
14 stars 3 forks source link

Unit tests with wrong `ts_id`failing #64

Closed stijnvanhoey closed 5 years ago

stijnvanhoey commented 5 years ago

Tests are failing (probably) due to changes in the API responses received from waterinfo.be. I can reproduce them locally:

── 1. Failure: datasource not included in the API call (@test-waterinfo_call.R#35)  ──────────────────────────────────────────────────────────────
`call_waterinfo(query)` threw an error with unexpected message.
Expected match: "API did not return json - The server encountered an .*"
Actual message: "Waterinfo API request failed [500]\nWaterinfo error:\n                InvalidParameterValue\nWaterinfo return message: ts_id must be a number."

── 2. Failure: tomcat error message content (@test-waterinfo_call.R#51)  ─────────────────────────────────────────────────────────────────────────
content(res, "text", encoding = "UTF-8") not identical to `tomcat_html_response`.
1/1 mismatches
x[1]: "{\"type\": \"error\", \"code\": \"InvalidParameterValue\", \"message\": \"ts_id must be a number.\"}"
y[1]: "<!doctype html><html lang=\"en\"><head><title>HTTP Status 500 – Internal Server Error</title><style type=\"text/css\">H1 {font-family:Tahom
y[1]: a,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-colo
y[1]: r:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:T
y[1]: ahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P 
y[1]: {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}.line {height:...

I assume the response on wrong ts_id as an input of the API is now checked differently. Need to be fixed by adjusting the tests...

stijnvanhoey commented 5 years ago

fixed by #65