@@ -278,6 +278,33 @@ def test_event_can_be_both_tracked_and_debugged():
278278 check_feature_event (output [2 ], e , True , user )
279279 check_summary_event (output [3 ])
280280
281+ def test_debug_mode_does_not_expire_if_both_client_time_and_server_time_are_before_expiration_time ():
282+ with DefaultTestProcessor () as ep :
283+ # Pick a server time that slightly different from client time
284+ server_time = now () + 1000
285+
286+ # Send and flush an event we don't care about, just to set the last server time
287+ mock_http .set_server_time (server_time )
288+ ep .send_event ({ 'kind' : 'identify' , 'user' : { 'key' : 'otherUser' }})
289+ flush_and_get_events (ep )
290+
291+ # Now send an event with debug mode on, with a "debug until" time that is further in
292+ # the future than both the client time and the server time
293+ debug_until = server_time + 10000
294+ e = {
295+ 'kind' : 'feature' , 'key' : 'flagkey' , 'version' : 11 , 'user' : user ,
296+ 'variation' : 1 , 'value' : 'value' , 'default' : 'default' ,
297+ 'trackEvents' : False , 'debugEventsUntilDate' : debug_until
298+ }
299+ ep .send_event (e )
300+
301+ # Should get a summary event only, not a full feature event
302+ output = flush_and_get_events (ep )
303+ assert len (output ) == 3
304+ check_index_event (output [0 ], e , user )
305+ check_feature_event (output [1 ], e , True , user ) # debug event
306+ check_summary_event (output [2 ])
307+
281308def test_debug_mode_expires_based_on_client_time_if_client_time_is_later_than_server_time ():
282309 with DefaultTestProcessor () as ep :
283310 # Pick a server time that is somewhat behind the client time
0 commit comments