You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I'm not sure if this is properly a bug or an enhancement, but something I was caught out by working with KeySet
fromunittest.mockimportMagicMockfromjoserfc.jwkimportKeySetkeyset=KeySet.import_key_set(MagicMock())
# Surprised that you can call import_key_set() and silently end# up without any keysassertkeyset.keys, "Whoops, no keys!"
We could make a case that this isn't a bug, "If someone does KeySet.import_key_set({'keys': []}) they obviously hoped to end up with an empty KeySet; the empty set is still a set," but I feel like the principle of least astonishment applies here. I imagine 99% of people who are importing a key set hope to end up with a set containing at least one key.
Are you open to a PR to change this behavior? I would expect import_key_set() to raise an exception if it's unable to load at least one key.
The text was updated successfully, but these errors were encountered:
Hello, I'm not sure if this is properly a bug or an enhancement, but something I was caught out by working with
KeySet
I think the issue is that
keys
defaults to an empty list here and there's no check on returning an empty list.We could make a case that this isn't a bug, "If someone does
KeySet.import_key_set({'keys': []})
they obviously hoped to end up with an empty KeySet; the empty set is still a set," but I feel like the principle of least astonishment applies here. I imagine 99% of people who are importing a key set hope to end up with a set containing at least one key.Are you open to a PR to change this behavior? I would expect
import_key_set()
to raise an exception if it's unable to load at least one key.The text was updated successfully, but these errors were encountered: