Skip to content

Commit

Permalink
fix: address review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Federico Bond <federicobond@gmail.com>
  • Loading branch information
federicobond committed Jul 18, 2023
1 parent 4d1b078 commit 77f43f9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 3 additions & 2 deletions open_feature/provider/in_memory_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ def _resolve(
if flag is None:
return FlagResolutionDetails(
value=default_value,
reason=Reason.DEFAULT,
variant=PASSED_IN_DEFAULT,
reason=Reason.ERROR,
error_code=ErrorCode.FLAG_NOT_FOUND,
error_message=f"Flag '{flag_key}' not found",
)
return flag.resolve(evaluation_context)
6 changes: 4 additions & 2 deletions tests/provider/test_in_memory_provider.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from numbers import Number

from open_feature.exception.error_code import ErrorCode
from open_feature.flag_evaluation.reason import Reason
from open_feature.flag_evaluation.resolution_details import FlagResolutionDetails
from open_feature.provider.in_memory_provider import InMemoryProvider, InMemoryFlag
Expand All @@ -24,8 +25,9 @@ def test_should_handle_unknown_flags_correctly():
assert flag is not None
assert flag.value is True
assert isinstance(flag.value, bool)
assert flag.reason == Reason.DEFAULT
assert flag.variant == "Passed in default"
assert flag.reason == Reason.ERROR
assert flag.error_code == ErrorCode.FLAG_NOT_FOUND
assert flag.error_message == "Flag 'Key' not found"


def test_calls_context_evaluator_if_present():
Expand Down

0 comments on commit 77f43f9

Please sign in to comment.