#NEWLINE# @ test . create_stubs ( { #NEWLINE# #INDENT# api . keystone : ( 'list_ec2_credentials' , ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# def test_credential_api( self ) : #NEWLINE# #INDENT# certs = self . ec2 . list ( ) #NEWLINE# api . keystone . list_ec2_credentials ( IsA ( HttpRequest ) , self . user . id ) . AndReturn ( certs ) #NEWLINE# self . mox . ReplayAll ( ) #NEWLINE# res = self . client . get ( CREDS_URL ) #NEWLINE# self . assertEqual ( res . status_code , 200 ) #NEWLINE# credentials = 'project/access_and_security/api_access/credentials.html' #NEWLINE# self . assertTemplateUsed ( res , credentials ) #NEWLINE# self . assertEqual ( self . user . id , res . context [ 'openrc_creds' ] [ 'user' ] . id ) #NEWLINE# self . assertEqual ( certs [ 0 ] . access , credentials . context [ 'ec2_creds' ] [ 'ec2_access_key' ] )