-
-
Notifications
You must be signed in to change notification settings - Fork 466
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 remove_client method to base_client.registry.BaseOAuth #585
base: master
Are you sure you want to change the base?
Conversation
Hi, thanks. It would be great if you can add a test case for this method. |
Sure I'll give that a go. Is there a development build that installs all dependencies needed for testing? And any other information on how you are running the tests? |
The whole testing process is automated with tox. Just run tox, and this will create environments for every python version supported, and a few dependency variants, and this will run pytest on those environments. |
Can I give a suggestion to change the method name to Code suggestion:
The method |
The register naming is not ideal anyways as it could be confused with registration like defined in OAuth 2.0 Dynamic Client Registration Protocol. In the long run I think keeping |
if name not in self._registry: | ||
raise KeyError(f'Client {name} not found in registry.') | ||
|
||
if name not in self._clients: | ||
raise KeyError(f'Client {name} not found in clients.') | ||
|
||
del self._registry[name] | ||
del self._clients[name] |
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.
Hello @lcdunne,
This might be implemented in a bit cleaner and safer way.
if name not in self._registry: | |
raise KeyError(f'Client {name} not found in registry.') | |
if name not in self._clients: | |
raise KeyError(f'Client {name} not found in clients.') | |
del self._registry[name] | |
del self._clients[name] | |
missing = [] | |
if not self._registry.pop(name, None): | |
missing.append['registry'] | |
if not self._clients.pop(name, None): | |
missing.append['clients'] | |
if missing: | |
raise KeyError(f'Client {name} not found in f{" nor ".join(missing)}.') |
Best regards!
Also, can you link this PR to that issue ( #583 ), like this? |
What kind of change does this PR introduce? (check at least one)
Feature to support removing a client from the
oauth
instance (see this issue). This works with the Flask client but I am not familiar with the other frameworks enough to set them up to check. As I mentioned in the issue thread it really looks like those other clients inherit from BaseOAuth but please let me know if I'm overlooking something. I'll try to add what is needed.