File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -180,6 +180,8 @@ class TestReference:
180
180
500 : exceptions .InternalError ,
181
181
}
182
182
183
+ duplicate_timestamp = time .time ()
184
+
183
185
@classmethod
184
186
def setup_class (cls ):
185
187
firebase_admin .initialize_app (testutils .MockCredential (), {'databaseURL' : cls .test_url })
@@ -413,14 +415,18 @@ def test_push_default(self):
413
415
assert len (recorder ) == 0
414
416
415
417
@pytest .mark .parametrize ('data' , valid_values )
416
- @mock .patch ('time.time' , mock .MagicMock (return_value = 1700497750.2549 ))
418
+ @mock .patch ('time.time' , mock .MagicMock (return_value = duplicate_timestamp ))
417
419
def test_push_duplicate_timestamp (self , data ):
418
420
ref = db .reference ('/test' )
419
421
recorder = self .instrument (ref , json .dumps ({}))
420
422
child = []
421
423
child .append (ref .push (data ))
422
424
child .append (ref .push (data ))
423
- assert child [1 ].key > child [0 ].key
425
+ key1 = child [0 ].key
426
+ key2 = child [1 ].key
427
+ # First 8 digits are the encoded timestamp
428
+ assert key1 [:8 ] == key2 [:8 ]
429
+ assert key2 > key1
424
430
assert len (recorder ) == 2
425
431
for index , record in enumerate (recorder ):
426
432
assert record .method == 'PUT'
You can’t perform that action at this time.
0 commit comments