Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def test_get_feature_states_for_identity( # type: ignore[no-untyped-def]
variant_1_percentage_allocation,
variant_1_value,
)
create_mv_option_with_api(
variant_2_mvfo_id = create_mv_option_with_api(
admin_client,
project,
multivariate_feature_id, # type: ignore[arg-type]
Expand Down Expand Up @@ -125,9 +125,11 @@ def test_get_feature_states_for_identity( # type: ignore[no-untyped-def]
feature_state_data = retrieve_feature_state_response.json()

# now let's amend the data so that all identities should receive variant 2
mv_values = feature_state_data["multivariate_feature_state_values"]
mv_values[0]["percentage_allocation"] = 0
mv_values[1]["percentage_allocation"] = 100
for mv_value in feature_state_data["multivariate_feature_state_values"]:
if mv_value["multivariate_feature_option"] == variant_2_mvfo_id:
mv_value["percentage_allocation"] = 100
else:
mv_value["percentage_allocation"] = 0

# and PUT the data back
update_feature_state_response = admin_client.put(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -598,14 +598,9 @@ def test_identities_endpoint_returns_value_for_segment_if_rule_type_percentage_s
segment=segment, type=SegmentRule.ALL_RULE
)

identity_percentage_value = get_hashed_percentage_for_object_ids(
[segment.id, identity.id]
)
Condition.objects.create(
operator=PERCENTAGE_SPLIT,
value=int(
(identity_percentage_value + (1 - identity_percentage_value) / 2) * 100.0
),
value=100,
rule=segment_rule,
)
feature_segment = FeatureSegment.objects.create(
Expand Down
Loading