Skip to content

Make centralauth work, write tests - #9

Open
adamwight wants to merge 4 commits into
masterfrom
centralauth
Open

Make centralauth work, write tests#9
adamwight wants to merge 4 commits into
masterfrom
centralauth

Conversation

@adamwight

Copy link
Copy Markdown
Collaborator

No description provided.

@adamwight
adamwight requested review from Ladsgroup and halfak February 8, 2018 15:40
Comment thread jade/centralauth.py Outdated

class CentralAuth:

class CentralAuth(object):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread jade/centralauth.py
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)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. Much better

# 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)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I understand this TODO.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@halfak

halfak commented Feb 8, 2018

Copy link
Copy Markdown
Member

A couple of comments, but otherwise, this looks great. Thanks for your work :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants