@@ -187,8 +187,7 @@ async def test_get_variant_value_returns_variant_when_rollout_percentage_hundred
187187 result = self ._flags .get_variant_value (TEST_FLAG_KEY , "fallback" , USER_CONTEXT )
188188 assert result != "fallback"
189189
190- # TODO Joshua start here
191- # TODO problem test doesn't fail
190+
192191 @respx .mock
193192 async def test_get_variant_value_respects_runtime_evaluation_rule_satisfied (self ):
194193 runtime_eval = {
@@ -220,7 +219,35 @@ def user_context_with_properties(self, properties: Dict[str, Any]) -> Dict[str,
220219 return context
221220
222221 @respx .mock
223- async def test_get_variant_value_respects_runtime_evaluation_satisfied (self ):
222+ async def test_get_variant_value_ignores_legacy_runtime_evaluation_definition_when_runtime_evaluation_rule_is_present__satisfied (self ):
223+ runtime_rule = {
224+ "==" : [{"var" : "plan" }, "premium" ]
225+ }
226+ legacy_runtime_definition = {"plan" : "basic" }
227+ flag = create_test_flag (runtime_evaluation_rule = runtime_rule , runtime_evaluation_legacy_definition = legacy_runtime_definition )
228+ await self .setup_flags ([flag ])
229+ context = self .user_context_with_properties ({
230+ "plan" : "premium" ,
231+ })
232+ result = self ._flags .get_variant_value (TEST_FLAG_KEY , "fallback" , context )
233+ assert result != "fallback"
234+
235+ @respx .mock
236+ async def test_get_variant_value_ignores_legacy_runtime_evaluation_definition_when_runtime_evaluation_rule_is_present__not_satisfied (self ):
237+ runtime_rule = {
238+ "==" : [{"var" : "plan" }, "basic" ]
239+ }
240+ legacy_runtime_definition = {"plan" : "premium" }
241+ flag = create_test_flag (runtime_evaluation_rule = runtime_rule , runtime_evaluation_legacy_definition = legacy_runtime_definition )
242+ await self .setup_flags ([flag ])
243+ context = self .user_context_with_properties ({
244+ "plan" : "premium" ,
245+ })
246+ result = self ._flags .get_variant_value (TEST_FLAG_KEY , "fallback" , context )
247+ assert result == "fallback"
248+
249+ @respx .mock
250+ async def test_get_variant_value_respects_legacy_runtime_evaluation_satisfied (self ):
224251 runtime_eval = {"plan" : "premium" , "region" : "US" }
225252 flag = create_test_flag (runtime_evaluation_legacy_definition = runtime_eval )
226253 await self .setup_flags ([flag ])
@@ -232,7 +259,7 @@ async def test_get_variant_value_respects_runtime_evaluation_satisfied(self):
232259 assert result != "fallback"
233260
234261 @respx .mock
235- async def test_get_variant_value_returns_fallback_when_runtime_evaluation_not_satisfied (self ):
262+ async def test_get_variant_value_returns_fallback_when_legacy_runtime_evaluation_not_satisfied (self ):
236263 runtime_eval = {"plan" : "premium" , "region" : "US" }
237264 flag = create_test_flag (runtime_evaluation_legacy_definition = runtime_eval )
238265 await self .setup_flags ([flag ])
0 commit comments