-
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.
- Loading branch information
1 parent
2856f8d
commit ccef02e
Showing
3 changed files
with
33 additions
and
32 deletions.
There are no files selected for viewing
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import pytest | ||
import requests_mock | ||
from open_feature.evaluation_context.evaluation_context import EvaluationContext | ||
|
||
from provider.provider import ConfidenceOpenFeatureProvider | ||
from tests.test_provider import SUCCESSFUL_STRING_FLAG_RESOLVE | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"apply_on_resolve", | ||
( | ||
(True, False) | ||
) | ||
) | ||
def test_apply_configurable(apply_on_resolve): | ||
ctx = EvaluationContext(targeting_key="meh") | ||
apply_provider = ConfidenceOpenFeatureProvider( | ||
client_secret="test", apply_on_resolve=apply_on_resolve | ||
) | ||
with requests_mock.Mocker() as mock: | ||
mock.post( | ||
"https://resolver.eu.confidence.dev/v1/flags:resolve", | ||
json=SUCCESSFUL_STRING_FLAG_RESOLVE, | ||
) | ||
|
||
apply_provider.resolve_string_details( | ||
flag_key="test-flag.color", | ||
default_value="yellow", | ||
evaluation_context=ctx, | ||
) | ||
|
||
last_request = mock.request_history[-1] | ||
assert last_request.json()["apply"] == apply_on_resolve |