diff --git a/switcher_client/switcher_data.py b/switcher_client/switcher_data.py index ac9fe4d..12dfa15 100644 --- a/switcher_client/switcher_data.py +++ b/switcher_client/switcher_data.py @@ -4,7 +4,7 @@ from dataclasses import dataclass from datetime import datetime from abc import ABCMeta -from typing import Optional, Union +from typing import Optional from switcher_client.lib.compat import Self from switcher_client.lib.utils import get @@ -48,7 +48,7 @@ def check_regex(self, input: str) -> Self: """ Adds REGEX_VALIDATION input for strategy validation """ return self.check(StrategiesType.REGEX.value, input) - def check_payload(self, input: Union[str, dict]) -> Self: + def check_payload(self, input: str | dict) -> Self: """ Adds PAYLOAD_VALIDATION input for strategy validation """ if isinstance(input, dict): payload_str = json.dumps(input) diff --git a/tests/test_switcher_stub.py b/tests/test_switcher_stub.py index 806032c..543098b 100644 --- a/tests/test_switcher_stub.py +++ b/tests/test_switcher_stub.py @@ -139,3 +139,18 @@ def isolated_context_result(): assert switcher.reset_inputs().is_on() assert isolated_result is False + + def test_switcher_stub_multiple_keys(self): + """ Should allow different bypass values for multiple keys """ + + # given + switcher1 = Client.get_switcher(self.key) + switcher2 = Client.get_switcher(self.key + "_2") + + # test + Client.assume(self.key).true() + Client.assume(self.key + "_2").false() + Client.assume(self.key + "_2").true() # override previous false assumption + + assert switcher1.is_on() + assert switcher2.is_on()