#NEWLINE# @ mock . patch ( 'keystoneclient.auth.identity.generic.password.Password' ) #NEWLINE# def test_get_os_admin_context( self , password_plugin ) : #NEWLINE# #INDENT# imp . reload ( ec2_context ) #NEWLINE# if ( not context . get_current ( ) ) : #NEWLINE# #INDENT# ec2_context . RequestContext ( None , None ) #NEWLINE# #UNINDENT# ctx = ec2_context . get_os_admin_context ( ) #NEWLINE# conf = cfg . CONF #NEWLINE# password_plugin . assert_called_once_with ( username = conf . admin_user , password = conf . admin_password , tenant_name = conf . admin_tenant_name , project_name = conf . admin_tenant_name , auth_url = conf . keystone_url ) #NEWLINE# self . assertIsNone ( ctx . user_id ) #NEWLINE# self . assertIsNone ( ctx . project_id ) #NEWLINE# self . assertIsNone ( ctx . auth_token ) #NEWLINE# self . assertEqual ( [ ] , ctx . service_catalog ) #NEWLINE# self . assertTrue ( conf . is_os_admin ) #NEWLINE# self . assertIsNotNone ( ctx . session ) #NEWLINE# self . assertIsNotNone ( ctx . session . auth ) #NEWLINE# self . assertNotEqual ( context . get_current ( ) , ctx ) #NEWLINE# password_plugin . reset_mock ( ) #NEWLINE# ec2_context . get_os_admin_context ( ) #NEWLINE# self . assertFalse ( password_plugin . called )