mirror of
https://gitlab.com/animath/si/plateforme-corres2math.git
synced 2025-02-06 12:53:03 +00:00
Simulate a fake Sympa client to run tests
This commit is contained in:
parent
98abe243a7
commit
c29ed171b4
@ -8,6 +8,17 @@ _client = None
|
|||||||
def get_sympa_client() -> Client:
|
def get_sympa_client() -> Client:
|
||||||
global _client
|
global _client
|
||||||
if _client is None:
|
if _client is None:
|
||||||
|
if os.getenv("SYMPA_PASSWORD", None) is not None:
|
||||||
_client = Client("https://" + os.getenv("SYMPA_URL"))
|
_client = Client("https://" + os.getenv("SYMPA_URL"))
|
||||||
_client.login(os.getenv("SYMPA_EMAIL"), os.getenv("SYMPA_PASSWORD"))
|
_client.login(os.getenv("SYMPA_EMAIL"), os.getenv("SYMPA_PASSWORD"))
|
||||||
|
else:
|
||||||
|
_client = FakeSympaSoapClient()
|
||||||
return _client
|
return _client
|
||||||
|
|
||||||
|
|
||||||
|
class FakeSympaSoapClient:
|
||||||
|
"""
|
||||||
|
Simulate a Sympa Soap client to run tests, if no Sympa instance is connected.
|
||||||
|
"""
|
||||||
|
def __getattribute__(self, item):
|
||||||
|
return lambda *args, **kwargs: None
|
||||||
|
Loading…
x
Reference in New Issue
Block a user