#NEWLINE# def test_import_keypair_invalid_key_name( self ) : #NEWLINE# #INDENT# key_name = 'invalid#key?name=!' #NEWLINE# public_key = 'ABCDEF' #NEWLINE# formData = { #NEWLINE# #INDENT# 'method' : 'ImportKeypair' , #NEWLINE# 'name' : key_name , #NEWLINE# 'public_key' : public_key , #NEWLINE# #UNINDENT# } #NEWLINE# url = reverse ( 'horizon:project:access_and_security:keypairs:import' ) #NEWLINE# res = self . client . post ( url , formData , follow = True ) #NEWLINE# self . assertEqual ( res . redirect_chain , [ ] ) #NEWLINE# msg = unicode ( KEYPAIR_ERROR_MESSAGES [ 'invalid' ] ) #NEWLINE# self . assertFormErrors ( res , count = 1 , message = msg )