Richard Nemeth
3 months ago
No known key found for this signature in database
GPG Key ID: 21C39470DF3DEC39
2 changed files with
10 additions and
0 deletions
-
src/keycloak/authorization/role.py
-
tests/test_authorization.py
|
|
@ -78,3 +78,12 @@ class Role: |
|
|
|
|
|
|
|
msg = f"Cannot compare Role with {type(other)}" |
|
|
|
raise NotImplementedError(msg) |
|
|
|
|
|
|
|
def __hash__(self) -> int: |
|
|
|
""" |
|
|
|
Hash method. |
|
|
|
|
|
|
|
:returns: Hash value |
|
|
|
:rtype: int |
|
|
|
""" |
|
|
|
return hash(f"{self.name}-{self.required}") |
|
|
@ -40,6 +40,7 @@ def test_authorization_objects() -> None: |
|
|
|
assert not r.required |
|
|
|
assert r.get_name() == "test" |
|
|
|
assert r == r # noqa: PLR0124 |
|
|
|
assert hash(r) == hash("test-False") |
|
|
|
assert r == "test" |
|
|
|
|
|
|
|
with pytest.raises(NotImplementedError) as err: |
|
|
|