Make centralauth work, write tests - #9
Conversation
|
|
||
| class CentralAuth: | ||
|
|
||
| class CentralAuth(object): |
There was a problem hiding this comment.
No longer necessary as of Python 3.0. https://stackoverflow.com/questions/15374857/should-all-python-classes-extend-object
| if 'locked' in gui_doc: | ||
| raise errors.UserLockedError( | ||
| "The user account with gu_id={0} is locked".format(gu_id)) | ||
| raise errors.UserLockedError(gu_id) |
| # def test_get_globaluser_info_invalid_user_id(): | ||
| # ca = CentralAuth.from_config(test_config) | ||
| # with pytest.raises(mwapi.errors.APIError): | ||
| # ca.get_globaluser_info(0) |
There was a problem hiding this comment.
It turns out, requesting non-existent users actually causes an APIError in mwapi, rather than the "missing" sad path. We probably need to handle this, and calling functions will be expecting differents types of jade.errors.UserPermissionError. We should consider wrapping the APIError... Also, the TODO is because I hadn't decided which code we should be checking. Now I think we should be mocking mwapi.Session.get to just throw an error, but first let's decide how the CentralAuth class will handle it.
|
A couple of comments, but otherwise, this looks great. Thanks for your work :) |
No description provided.