#NEWLINE# def testEnrollment( self ) : #NEWLINE# #INDENT# 'Test the http response to unknown clients.' #NEWLINE# self . server_communicator . client_cache . Flush ( ) #NEWLINE# self . client = aff4 . FACTORY . Create ( self . client_cn , 'VFSGRRClient' , mode = 'rw' , token = self . token ) #NEWLINE# self . client . DeleteAttribute ( self . client . Schema . CERT ) #NEWLINE# self . client . Flush ( ) #NEWLINE# self . SendToServer ( ) #NEWLINE# status = self . client_communicator . RunOnce ( ) #NEWLINE# self . assertEqual ( status . code , 406 ) #NEWLINE# self . assertEqual ( len ( self . messages ) , 10 ) #NEWLINE# self . assertEqual ( self . messages [ 0 ] . auth_state , rdf_flows . GrrMessage . AuthorizationState . UNAUTHENTICATED ) #NEWLINE# status = self . client_communicator . RunOnce ( ) #NEWLINE# self . assertEqual ( len ( self . messages ) , 11 ) #NEWLINE# self . assertEqual ( self . messages [ ( - 1 ) ] . session_id , ca_enroller . Enroler . well_known_session_id ) #NEWLINE# flow_obj = aff4 . Enroler ( aff4 . Enroler . well_known_session_id , mode = 'rw' , token = self . token ) #NEWLINE# flow_obj . ProcessMessage ( self . messages [ ( - 1 ) ] ) #NEWLINE# status = self . client_communicator . RunOnce ( ) #NEWLINE# self . assertEqual ( status . code , 200 ) #NEWLINE# self . client = aff4 . FACTORY . Create ( self . client_cn , 'VFSGRRClient' , mode = 'rw' , token = self . token ) #NEWLINE# self . assertTrue ( self . client . Get ( self . client . Schema . CERT ) ) #NEWLINE# self . SendToServer ( ) #NEWLINE# status = self . client_communicator . RunOnce ( ) #NEWLINE# self . assertEqual ( status . code , 200 )