Richard Nemeth
11 months ago
No known key found for this signature in database
GPG Key ID: 21C39470DF3DEC39
4 changed files with
57 additions and
6 deletions
-
tests/test_connection.py
-
tests/test_keycloak_admin.py
-
tests/test_keycloak_openid.py
-
tests/test_keycloak_uma.py
|
|
@ -1,6 +1,6 @@ |
|
|
|
"""Connection test module.""" |
|
|
|
|
|
|
|
from inspect import signature |
|
|
|
from inspect import iscoroutinefunction, signature |
|
|
|
|
|
|
|
import pytest |
|
|
|
|
|
|
@ -62,11 +62,35 @@ def test_counter_part(): |
|
|
|
con_methods = [ |
|
|
|
func for func in dir(ConnectionManager) if callable(getattr(ConnectionManager, func)) |
|
|
|
] |
|
|
|
sync_methods = [method for method in con_methods if method.startswith("a_")] |
|
|
|
sync_methods = [ |
|
|
|
method |
|
|
|
for method in con_methods |
|
|
|
if not method.startswith("a_") and not method.startswith("_") |
|
|
|
] |
|
|
|
async_methods = [ |
|
|
|
method for method in con_methods if iscoroutinefunction(getattr(ConnectionManager, method)) |
|
|
|
] |
|
|
|
|
|
|
|
for method in sync_methods: |
|
|
|
async_method = method[2:] |
|
|
|
if method in [ |
|
|
|
"aclose", |
|
|
|
"add_param_headers", |
|
|
|
"del_param_headers", |
|
|
|
"clean_headers", |
|
|
|
"exist_param_headers", |
|
|
|
"param_headers", |
|
|
|
]: |
|
|
|
continue |
|
|
|
async_method = f"a_{method}" |
|
|
|
assert (async_method in con_methods) is True |
|
|
|
sync_sign = signature(getattr(ConnectionManager, method)) |
|
|
|
async_sign = signature(getattr(ConnectionManager, async_method)) |
|
|
|
assert sync_sign.parameters == async_sign.parameters |
|
|
|
|
|
|
|
for async_method in async_methods: |
|
|
|
if async_method in ["aclose"]: |
|
|
|
continue |
|
|
|
if async_method[2:].startswith("_"): |
|
|
|
continue |
|
|
|
|
|
|
|
assert async_method[2:] in sync_methods |
|
|
@ -3,7 +3,7 @@ |
|
|
|
import copy |
|
|
|
import os |
|
|
|
import uuid |
|
|
|
from inspect import signature |
|
|
|
from inspect import iscoroutinefunction, signature |
|
|
|
from typing import Tuple |
|
|
|
|
|
|
|
import freezegun |
|
|
@ -6157,6 +6157,9 @@ def test_counter_part(): |
|
|
|
for method in admin_methods |
|
|
|
if not method.startswith("a_") and not method.startswith("_") |
|
|
|
] |
|
|
|
async_methods = [ |
|
|
|
method for method in admin_methods if iscoroutinefunction(getattr(KeycloakAdmin, method)) |
|
|
|
] |
|
|
|
|
|
|
|
for method in sync_methods: |
|
|
|
async_method = f"a_{method}" |
|
|
@ -6164,3 +6167,9 @@ def test_counter_part(): |
|
|
|
sync_sign = signature(getattr(KeycloakAdmin, method)) |
|
|
|
async_sign = signature(getattr(KeycloakAdmin, async_method)) |
|
|
|
assert sync_sign.parameters == async_sign.parameters |
|
|
|
|
|
|
|
for async_method in async_methods: |
|
|
|
if async_method[2:].startswith("_"): |
|
|
|
continue |
|
|
|
|
|
|
|
assert async_method[2:] in sync_methods |
|
|
@ -1,6 +1,6 @@ |
|
|
|
"""Test module for KeycloakOpenID.""" |
|
|
|
|
|
|
|
from inspect import signature |
|
|
|
from inspect import iscoroutinefunction, signature |
|
|
|
from typing import Tuple |
|
|
|
from unittest import mock |
|
|
|
|
|
|
@ -984,6 +984,9 @@ def test_counter_part(): |
|
|
|
for method in openid_methods |
|
|
|
if not method.startswith("a_") and not method.startswith("_") |
|
|
|
] |
|
|
|
async_methods = [ |
|
|
|
method for method in openid_methods if iscoroutinefunction(getattr(KeycloakOpenID, method)) |
|
|
|
] |
|
|
|
|
|
|
|
for method in sync_methods: |
|
|
|
async_method = f"a_{method}" |
|
|
@ -991,3 +994,9 @@ def test_counter_part(): |
|
|
|
sync_sign = signature(getattr(KeycloakOpenID, method)) |
|
|
|
async_sign = signature(getattr(KeycloakOpenID, async_method)) |
|
|
|
assert sync_sign.parameters == async_sign.parameters |
|
|
|
|
|
|
|
for async_method in async_methods: |
|
|
|
if async_method[2:].startswith("_"): |
|
|
|
continue |
|
|
|
|
|
|
|
assert async_method[2:] in sync_methods |
|
|
@ -1,7 +1,7 @@ |
|
|
|
"""Test module for KeycloakUMA.""" |
|
|
|
|
|
|
|
import re |
|
|
|
from inspect import signature |
|
|
|
from inspect import iscoroutinefunction, signature |
|
|
|
|
|
|
|
import pytest |
|
|
|
|
|
|
@ -610,6 +610,9 @@ def test_counter_part(): |
|
|
|
for method in uma_methods |
|
|
|
if not method.startswith("a_") and not method.startswith("_") |
|
|
|
] |
|
|
|
async_methods = [ |
|
|
|
method for method in uma_methods if iscoroutinefunction(getattr(KeycloakUMA, method)) |
|
|
|
] |
|
|
|
|
|
|
|
for method in sync_methods: |
|
|
|
async_method = f"a_{method}" |
|
|
@ -617,3 +620,9 @@ def test_counter_part(): |
|
|
|
sync_sign = signature(getattr(KeycloakUMA, method)) |
|
|
|
async_sign = signature(getattr(KeycloakUMA, async_method)) |
|
|
|
assert sync_sign.parameters == async_sign.parameters |
|
|
|
|
|
|
|
for async_method in async_methods: |
|
|
|
if async_method[2:].startswith("_"): |
|
|
|
continue |
|
|
|
|
|
|
|
assert async_method[2:] in sync_methods |