#NEWLINE# @ test . create_stubs ( { #NEWLINE# #INDENT# api . nova : ( 'keypair_import' , ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# def test_import_keypair_with_regex_defined_name( self ) : #NEWLINE# #INDENT# key1_name = 'new-key-pair with_regex' #NEWLINE# public_key = 'ssh-rsa ABCDEFGHIJKLMNOPQR\r\nSTUVWXYZ1234567890\rXXYYZZ user@computer\n\n' #NEWLINE# api . nova . keypair_import ( IsA ( http . HttpRequest ) , key1_name , public_key . replace ( '\r' , '' ) . replace ( '\n' , '' ) ) #NEWLINE# self . mox . ReplayAll ( ) #NEWLINE# formData = { #NEWLINE# #INDENT# 'method' : 'ImportKeypair' , #NEWLINE# 'name' : key1_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 ) #NEWLINE# self . assertMessageCount ( res , success = 1 )