Skip to content

Commit f8770f0

Browse files
committed
fix(API): Remove unused **flagsmith_kwargs from get_openfeature_client
Custom kwargs bypassed get_provider_kwargs() entirely, meaning essential properties like the API key were never set when kwargs were provided.
1 parent 22a78ba commit f8770f0

File tree

2 files changed

+1
-26
lines changed

2 files changed

+1
-26
lines changed

api/integrations/flagsmith/client.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,10 @@
3131

3232
def get_openfeature_client(
3333
domain: str = DEFAULT_OPENFEATURE_DOMAIN,
34-
**flagsmith_kwargs: typing.Any,
3534
) -> OpenFeatureClient:
3635
openfeature_client = openfeature_api.get_client(domain=domain)
3736
if openfeature_client.get_provider_status() != ProviderStatus.READY:
38-
initialise_provider(domain, **(flagsmith_kwargs or get_provider_kwargs()))
37+
initialise_provider(domain, **get_provider_kwargs())
3938
return openfeature_client
4039

4140

api/tests/unit/integrations/flagsmith/test_unit_flagsmith_client.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -84,30 +84,6 @@ def test_get_openfeature_client__provider_ready__skips_initialisation(
8484
mock_openfeature_api.set_provider.assert_not_called()
8585

8686

87-
def test_get_openfeature_client__custom_flagsmith_kwargs__passes_to_provider(
88-
settings: SettingsWrapper,
89-
mocker: MockerFixture,
90-
mock_local_file_handler: MagicMock,
91-
mock_local_file_handler_class: MagicMock,
92-
) -> None:
93-
# Given
94-
settings.FLAGSMITH_ON_FLAGSMITH_SERVER_OFFLINE_MODE = True
95-
96-
mock_openfeature_api = mocker.patch("integrations.flagsmith.client.openfeature_api")
97-
mock_client = mock_openfeature_api.get_client.return_value
98-
mock_client.get_provider_status.return_value = ProviderStatus.NOT_READY
99-
100-
mock_flagsmith_class = mocker.patch("integrations.flagsmith.client.Flagsmith")
101-
mocker.patch("integrations.flagsmith.client.FlagsmithProvider")
102-
103-
# When
104-
get_openfeature_client(enable_local_evaluation=False)
105-
106-
# Then
107-
call_args = mock_flagsmith_class.call_args
108-
assert call_args.kwargs["enable_local_evaluation"] is False
109-
110-
11187
def test_initialise_provider__offline_mode_disabled__initialises_with_server_key(
11288
settings: SettingsWrapper,
11389
mocker: MockerFixture,

0 commit comments

Comments
 (0)