-
Notifications
You must be signed in to change notification settings - Fork 23
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
Add test VersionHandler; Update Version Handler's API #130
Conversation
Shuld we remove this; isn't it equivalent to the endpoint responding?bookstore/bookstore/handlers.py Lines 43 to 48 in aa4e1e3
This comment was generated by todo based on a
|
Should we remove this; isn't it equivalent to the endpoint responding?bookstore/bookstore/handlers.py Lines 43 to 48 in e1d393b
This comment was generated by todo based on a
|
Codecov Report
@@ Coverage Diff @@
## master #130 +/- ##
==========================================
+ Coverage 47.32% 48.14% +0.82%
==========================================
Files 11 11
Lines 374 378 +4
==========================================
+ Hits 177 182 +5
+ Misses 197 196 -1 |
Codecov Report
@@ Coverage Diff @@
## master #130 +/- ##
==========================================
+ Coverage 79.14% 79.57% +0.43%
==========================================
Files 10 10
Lines 422 426 +4
==========================================
+ Hits 334 339 +5
+ Misses 88 87 -1 |
bookstore/tests/test_handlers.py
Outdated
""" | ||
get_handler = self.get_handler('/api/bookstore/') | ||
setattr(get_handler, '_transforms', []) | ||
get_handler.get() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't assert anything. There's a lot of code issues that would appear to pass this test when they are in fact not doing what's intended
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're not doing this with all of the other handler tests. I agree it would be better, but I am not aiming at ideal right now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are those code issues?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if the get returns None? Or get_handler returns the post handler? This test as is doesn't confirm much.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the get should return None
given the way that tornado handlers are defined (it treats the finish as a side-effect that I'm not sure how to hook into).
What it confirms is that the code runs without raising an error, meaning we've met the API for the get
method, and that such a handler can be created without issue.
The problem is there is no way that I can seem to get access to whatever is sent over the wire based on get.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of API design comments. It feels a bit squishy to have release version and validation together. Would it be preferable to have releases
, features
(validation
seems more like something that has been done. From an api user standpoint, would it be more beneficial for me to know which features are possible, available, valid, and their settings?).
Should we remove this; isn't it equivalent to the endpoint responding?bookstore/bookstore/handlers.py Lines 43 to 48 in 1489aec
This comment was generated by todo based on a
|
84a6a23
to
bfeecf1
Compare
This is used inside the load_server_extension function to populate the settings dictionary for access in the handler itself.
This requires patching the handler's _transforms method to avoid raising an error when we run self.finish() on the handler code side. This is likely an issue that we needed to deal with for other handlers but have not appropriately done. This is something we should revisit.
- suggestion originates from code review
@willingc I'm sorry I missed your comment about changing the name of the top level property of the API response from "validation" to "features" — I just caught it and made the change |
I don't see any outstanding issues in this PR so I am going to merge. Thanks @mpacer 🌻 |
Thanks! |
This refactors a bit of the data manipulation code in the handlers into individually testable utils.
This adds tests for the BookstoreVersionHandler.
There are a lot of issues that became obvious as I wrote these tests & helper utils. I will create separate issues for them, but I wanted to list them here.
handlers.py
module, into it's own module.Specifically, this would involve removing the
"bookstore": True
bit in the response from the BookstoreVersionHandler