-
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
Refactor requests out to a private function #89
Comments
I agree. In this specific case, I think another small refactor should be done, that moves all the requests out to a private function, to ensure they are all doing the same. Right now, there are multiple variations, for example: Group uses the auth_headers, sets a self.variable and returns it
Chat uses some private headers and returns the
Events does the same as Groups
UpdateEvents Uses its own headers, but returns
I feel that these should probably all use a common something like
So the other functions can simply do
And ensure that the headers contain all the necessary parameters, charset in the content-type etc. |
I guess the inconsistency in The refactor would prevent that in future, allow unit testing of a key component and resolve a lot of the inconsistencies (a bit of a chicken and egg problem as what should be returned isn't always documented). But as a private function, I don't think it shouldn't have any effect on (or block writing of) an end-to-end manually reviewed test of output from the public functions - I missed out that key word. |
The original issue ("Add some form of standard test for assurance when making changes") is resolved. But have kept + renamed, as the refactor proposal remains. |
Thinking about my missing one of the required changes to headers changes in #84 which meant
get_events()
didnn't authenticate...I know it's difficult for this kind of library to run e.g. a proper fully-automated test suite on push/merge, as it depends on user authentication, but maybe a first step would be to have a standard script which can be run in local dev environment, includes logging and covers as much of the functionality as possible? (e.g. get names of all groups; use one of the group IDs to get one group; get a few events; use one of the group IDs to get one group)
I am kind of putting some of this together anyway for my own assurance, but I don't really use chat or write events, so it's not going to be complete... but I think I'll pull something together and comment what should be added.
(I know it's possible to unit test some of the behaviour, by e.g. mocking responses, but I think that would come later, as probably needs refactoring first.)
The text was updated successfully, but these errors were encountered: