diff --git a/api/tests/integration/environments/identities/test_integration_identities.py b/api/tests/integration/environments/identities/test_integration_identities.py index ae16baa46445..6657d7366be6 100644 --- a/api/tests/integration/environments/identities/test_integration_identities.py +++ b/api/tests/integration/environments/identities/test_integration_identities.py @@ -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] @@ -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( diff --git a/api/tests/unit/environments/identities/test_unit_identities_views.py b/api/tests/unit/environments/identities/test_unit_identities_views.py index dff9ed67bead..86d2d6f2ecb6 100644 --- a/api/tests/unit/environments/identities/test_unit_identities_views.py +++ b/api/tests/unit/environments/identities/test_unit_identities_views.py @@ -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(