-
Notifications
You must be signed in to change notification settings - Fork 192
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
[test] api/endpoints.py needs more tests coverage #3204
Comments
The fact we need to mock that much is probably a sign that the application is not simple enough and would deserve some refactoring. Probably the return should be at the end and handle all the cases, once all the parameters have been defined.
Our function needs probably to be refactored so that it becomes easier to test. See previous commit.
since 2016, the code has a blueprint for errors which is… not used. |
Unused means no errors caused by this code, right??? |
@miketaylr I don't think any current views are returning something because of this blueprint, or said in anothe way, it seems we could delete it without any impact, I haven't tried it yet. |
Are we sure this isn't actually used? AFAICT, this is the only thing controlling the error messages that we do see (like |
ah right then it's used! And it's magical and I need to double check something. Thanks for digging this. This is working indeed! Cool.
HTTP/1.1 404 NOT FOUND
Connection: keep-alive
Content-Length: 61
Content-Security-Policy: default-src 'self'; object-src 'none'; connect-src 'self' https://api.github.com; font-src 'self' https://fonts.gstatic.com; img-src 'self' https://www.google-analytics.com https://*.githubusercontent.com data:; manifest-src 'self'; script-src 'self' https://www.google-analytics.com https://api.github.com 'nonce-d054ca11323e0f9e2725f2b8121d14960c98e8af'; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; base-uri 'self'; frame-ancestors 'self'; report-uri /csp-report
Content-Type: application/json
Date: Thu, 14 May 2020 21:19:39 GMT
Server: nginx/1.14.0 (Ubuntu)
Set-Cookie: exp=v2; Expires=Thu, 21-May-2020 21:19:39 GMT; Max-Age=604800; Path=/
Strict-Transport-Security: max-age=31536000; includeSubDomains;
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block
{
"message": "Not Found. Lost in Punk Cat Space",
"status": 404
} That will simplify my tests reasoning and removes one modification I did yesterday. My test was bad. |
one thing i like about the combination of pytest and coverage is that it really shows what is not tested.
|
@miketaylr ah just realized this webcompat.com/tests/unit/test_api_urls.py Line 54 in ad69300
And now trying to understand we decided to do that. |
Maybe this needs to be revisited. |
That was previous to the work done by bea in #1588 And we could revert the decision of |
webcompat.com/webcompat/api/endpoints.py
Line 30 in 136607e
The API is only partially tested currently. (69% as of today) and would benefit of a better coverage.
The text was updated successfully, but these errors were encountered: