Note that assert statements get stripped out of .pyo files, which are typically how applications are deployed in production. Thus, this assert statement will not run in production. I recommend something like this instead:
if not result: raise RuntimeError("Unable to communicate with database.")
You could also return explictly with an HTTP 500 instead of raising RuntimeError, if you prefer.
I recommend tests for this change. Otherwise, LGTM.
:thumbsup:
Sorry, this was a mistake. I copied this from WaiverDB and completely forgot that Greenwave does not have a database yet, :-). I will find another way to do it.
Yeah, this is a good point. I'll fix this in WaiverDB to not use assert statements.
rebased
Rebased to address the comments.
I guess it doesn't really belong in test_api_v1.py since the healthcheck endpoint is not part of /api/v1.0... You could add a new test file. Or just leave it here, not a big deal.
:+1:, up to you if you want to move the test to a separate file
Pull-Request has been merged by mjia