Mocker en python une condition if d'une méthode
Bonjour
Je souhaiterais savoir comment mocker une condition if d'une méthode.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
class FeatEng:
@staticmethod
def is_activated(feat_flag):
client = app_client_instance
if client.is_client_created():
value = client.get_value(feat_flag)
return "true" == value
Test class sample code:
FeatEng.is_activated = MagicMock(name='is_activated')
FeatEng.is_activated.client = client
FeatEng.is_activated.value = client.get_value.return_value
FeatEng.is_activated.return_value = ("true" == FeatEng.is_activated.value) |
Cdt