Skip to content

Commit b9e28d8

Browse files
committed
add test
1 parent 117aae8 commit b9e28d8

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

providers/openfeature-provider-ofrep/tests/test_provider.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,28 @@ def test_provider_typecheck_flag_value(ofrep_provider, requests_mock):
166166
ofrep_provider.resolve_boolean_details("flag_key", False)
167167

168168

169+
def test_provider_missing_metadata_field(ofrep_provider, requests_mock):
170+
"""Test that provider handles missing metadata field gracefully"""
171+
requests_mock.post(
172+
"http://localhost:8080/ofrep/v1/evaluate/flags/flag_key",
173+
json={
174+
"key": "flag_key",
175+
"reason": "TARGETING_MATCH",
176+
"variant": "true",
177+
"value": True,
178+
},
179+
)
180+
181+
resolution = ofrep_provider.resolve_boolean_details("flag_key", False)
182+
183+
assert resolution == FlagResolutionDetails(
184+
value=True,
185+
reason=Reason.TARGETING_MATCH,
186+
variant="true",
187+
flag_metadata={},
188+
)
189+
190+
169191
@pytest.mark.parametrize(
170192
"base_url",
171193
[

0 commit comments

Comments
 (0)