-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into 684_serial-detector-params
- Loading branch information
Showing
7 changed files
with
59 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/mx_bluesky/common/external_interaction/test_config_server.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
from functools import cache | ||
|
||
import pytest | ||
|
||
from mx_bluesky.common.external_interaction.config_server import FeatureFlags | ||
|
||
|
||
class MockConfigServer: | ||
def best_effort_get_all_feature_flags(self): | ||
return { | ||
"feature_a": False, | ||
"feature_b": False, | ||
} | ||
|
||
|
||
class FakeFeatureFlags(FeatureFlags): | ||
@staticmethod | ||
@cache | ||
def get_config_server() -> MockConfigServer: # type: ignore | ||
return MockConfigServer() | ||
|
||
feature_a: bool = False | ||
feature_b: bool = False | ||
|
||
|
||
@pytest.fixture | ||
def fake_feature_flags(): | ||
return FakeFeatureFlags(feature_a=False, feature_b=False) | ||
|
||
|
||
def test_valid_overridden_features(fake_feature_flags: FakeFeatureFlags): | ||
assert fake_feature_flags.feature_a is False | ||
assert fake_feature_flags.feature_b is False | ||
|
||
|
||
def test_invalid_overridden_features(): | ||
with pytest.raises(ValueError, match="Invalid feature toggle"): | ||
FakeFeatureFlags(feature_x=True) # type: ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters