#NEWLINE# @ mock . patch ( 'changes.lib.snapshot_garbage_collection.get_current_datetime' ) #NEWLINE# def test_cache_snapshot_images_have_no_expiration( self , get_current_datetime ) : #NEWLINE# #INDENT# project = self . create_project ( ) #NEWLINE# snapshot = self . create_snapshot ( project ) #NEWLINE# plans = [ self . create_plan ( project ) for _ in range ( 3 ) ] #NEWLINE# snapshot_images = [ self . create_snapshot_image ( snapshot , plan ) for plan in plans ] #NEWLINE# snapshot_image_ids = [ image . id for image in snapshot_images ] #NEWLINE# get_current_datetime . return_value = _ . mock_datetime #NEWLINE# gc . cache_snapshot ( snapshot ) #NEWLINE# assert ( not db . session . query ( CachedSnapshotImage . query . filter ( CachedSnapshotImage . id . in_ ( snapshot_image_ids ) , ( CachedSnapshotImage . expiration_date != None ) ) . exists ( ) ) . scalar ( ) )