diff --git a/pyproject.toml b/pyproject.toml index 17fd838..3585173 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,6 +21,7 @@ server = ["fastapi", "redis", "hiredis"] dev = [ "copier", "httpx", + "mockito", "pipdeptree", "pre-commit", "pyright", diff --git a/src/daq_config_server/constants.py b/src/daq_config_server/constants.py index caa3237..3a5f71e 100644 --- a/src/daq_config_server/constants.py +++ b/src/daq_config_server/constants.py @@ -4,6 +4,7 @@ @dataclass(frozen=True) class Endpoints: FEATURE = "/featureflag" + FEATURE_DISALLOWED_SPECIALS = ["all"] BL_PARAM = "/beamlineparameters" INFO = "/info" diff --git a/tests/test_api.py b/tests/test_api.py index ccb889e..0825231 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -5,6 +5,7 @@ import pytest from fastapi import status from fastapi.testclient import TestClient +from mockito import when from daq_config_server.app import app from daq_config_server.beamline_parameters import GDABeamlineParameters @@ -52,3 +53,15 @@ async def test_get_feature_list(self, mock_valkey: MagicMock, mock_app): ENDPOINTS.FEATURE, test_param_list, ) + + @patch("daq_config_server.app.valkey") + async def test_get_feature_list_w_values(self, mock_valkey: MagicMock, mock_app): + test_params = {"param_1": True, "param_2": True, "param_3": False} + mock_valkey.smembers.return_value = list(test_params.keys()) + for param, value in test_params.items(): + when(mock_valkey).get(param).thenReturn(value) + await _assert_get_and_response( + mock_app, + ENDPOINTS.FEATURE + "?get_values=true", + test_params, + )