#NEWLINE# @ mock . patch ( 'changes.lib.snapshot_garbage_collection.get_current_datetime' ) #NEWLINE# def test_multiproject( self , get_current_datetime ) : #NEWLINE# #INDENT# '\n        Integration test (minus mocking out time) on the endpoint, which is\n        different from the lib-tests which mock out get_plans in the garbage\n        collector.\n        ' #NEWLINE# project1 = self . create_project ( ) #NEWLINE# project2 = self . create_project ( ) #NEWLINE# plan1_1 = self . create_plan ( project1 ) #NEWLINE# plan1_2 = self . create_plan ( project1 ) #NEWLINE# plan2_1 = self . create_plan ( project2 ) #NEWLINE# plan2_2 = self . create_plan ( project2 ) #NEWLINE# plan2_3 = self . create_plan ( project2 ) #NEWLINE# self . create_step ( plan1_1 , data = { #NEWLINE# #INDENT# 'cluster' : 'cluster1' , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . create_step ( plan1_2 , data = { #NEWLINE# #INDENT# 'cluster' : 'cluster2' , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . create_step ( plan2_1 , data = { #NEWLINE# #INDENT# 'cluster' : 'cluster2' , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . create_step ( plan2_2 , data = { #NEWLINE# #INDENT# 'cluster' : 'cluster2' , #NEWLINE# #UNINDENT# } ) #NEWLINE# snapshot1 = self . create_snapshot ( project1 ) #NEWLINE# snapshot2 = self . create_snapshot ( project2 ) #NEWLINE# snapshot_image1_1 = self . create_snapshot_image ( snapshot1 , plan1_1 ) #NEWLINE# snapshot_image1_2 = self . create_snapshot_image ( snapshot1 , plan1_2 ) #NEWLINE# snapshot_image2_1 = self . create_snapshot_image ( snapshot2 , plan2_1 ) #NEWLINE# snapshot_image2_2 = self . create_snapshot_image ( snapshot2 , plan2_2 ) #NEWLINE# snapshot_image2_3 = self . create_snapshot_image ( snapshot2 , plan2_3 ) #NEWLINE# self . create_cached_snapshot_image ( snapshot_image1_1 ) #NEWLINE# self . create_cached_snapshot_image ( snapshot_image1_2 , expiration_date = ( self . mock_datetime + datetime . timedelta ( 0 , 1 ) ) ) #NEWLINE# self . create_cached_snapshot_image ( snapshot_image2_1 , expiration_date = ( self . mock_datetime - datetime . timedelta ( 0 , 1 ) ) ) #NEWLINE# self . create_cached_snapshot_image ( snapshot_image2_2 ) #NEWLINE# self . create_cached_snapshot_image ( snapshot_image2_3 ) #NEWLINE# get_current_datetime . return_value = self . mock_datetime #NEWLINE# resp = self . client . get ( self . get_endpoint_path ( 'cluster2' ) ) #NEWLINE# assert ( resp . status_code == 200 ) #NEWLINE# data = self . unserialize ( resp ) #NEWLINE# assert ( len ( data ) == 2 ) #NEWLINE# assert ( snapshot_image1_2 . id . hex in data ) #NEWLINE# assert ( snapshot_image2_2 . id . hex in data ) #NEWLINE# resp = self . client . get ( self . get_endpoint_path ( 'cluster3' ) ) #NEWLINE# assert ( resp . status_code == 200 ) #NEWLINE# data = self . unserialize ( resp ) #NEWLINE# assert ( data == [ ] )