#NEWLINE# def test_least_routers_schedule( self ) : #NEWLINE# #INDENT# hosting_agents = self . _pre_scheduler_routers ( self . scheduler , self . scheduled_router_count ) #NEWLINE# actual_scheduled_agent = self . scheduler . schedule ( self . l3_plugin , self . adminContext , self . routers [ ( - 1 ) ] [ 'id' ] ) #NEWLINE# if self . expected_scheduled_router_count : #NEWLINE# #INDENT# if ( self . agent_count == 1 ) : #NEWLINE# #INDENT# self . assertEqual ( actual_scheduled_agent . id , self . l3_agents [ 0 ] . id ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . assertNotIn ( actual_scheduled_agent . id , [ x . id for x in hosting_agents ] , message = 'The expected agent was not scheduled' ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# self . assertIsNone ( actual_scheduled_agent , message = 'Expected no agent to be scheduled, but it got scheduled' )