Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions switcher_client/switcher_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
15 changes: 15 additions & 0 deletions tests/test_switcher_stub.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Loading