@@ -196,30 +196,22 @@ async def test_get_variant_value_respects_runtime_evaluation_rule_satisfied(self
196196 }
197197 flag = create_test_flag (runtime_evaluation_rule = runtime_eval )
198198 await self .setup_flags ([flag ])
199- context = {
200- "distinct_id" : DISTINCT_ID ,
201- "custom_properties" : {
202- "plan" : "premium" ,
203- "region" : "US"
204- }
205- }
199+ context = self .user_context_with_properties ({
200+ "plan" : "premium" ,
201+ })
206202 result = self ._flags .get_variant_value (TEST_FLAG_KEY , "fallback" , context )
207203 assert result != "fallback"
208204
209205 @respx .mock
210206 async def test_get_variant_value_respects_runtime_evaluation_rule_not_satisfied (self ):
211207 runtime_eval = {
212- "==" : [{"var" : "plan" }, "basic " ]
208+ "==" : [{"var" : "plan" }, "premium " ]
213209 }
214210 flag = create_test_flag (runtime_evaluation_rule = runtime_eval )
215211 await self .setup_flags ([flag ])
216- context = {
217- "distinct_id" : DISTINCT_ID ,
218- "custom_properties" : {
219- "plan" : "premium" ,
220- "region" : "US"
221- }
222- }
212+ context = self .user_context_with_properties ({
213+ "plan" : "basic" ,
214+ })
223215 result = self ._flags .get_variant_value (TEST_FLAG_KEY , "fallback" , context )
224216 assert result == "fallback"
225217
@@ -244,13 +236,10 @@ async def test_get_variant_value_returns_fallback_when_runtime_evaluation_not_sa
244236 runtime_eval = {"plan" : "premium" , "region" : "US" }
245237 flag = create_test_flag (runtime_evaluation_legacy_definition = runtime_eval )
246238 await self .setup_flags ([flag ])
247- context = {
248- "distinct_id" : DISTINCT_ID ,
249- "custom_properties" : {
250- "plan" : "basic" ,
251- "region" : "US"
252- }
253- }
239+ context = self .user_context_with_properties ({
240+ "plan" : "basic" ,
241+ "region" : "US"
242+ })
254243 result = self ._flags .get_variant_value (TEST_FLAG_KEY , "fallback" , context )
255244 assert result == "fallback"
256245
0 commit comments