#NEWLINE# @ patch ( 'ramses.auth.ACLAuthorizationPolicy' ) #NEWLINE# def test_policies_calls( self , mock_acl ) : #NEWLINE# #INDENT# from ramses import auth #NEWLINE# scheme = Mock ( type = 'mytype' , settings = { #NEWLINE# #INDENT# 'name' : 'user1' , #NEWLINE# #UNINDENT# } ) #NEWLINE# scheme . name = 'foo' #NEWLINE# raml_data = Mock ( secured_by = [ 'foo' ] , security_schemes = [ scheme ] ) #NEWLINE# config = Mock ( ) #NEWLINE# mock_setup = Mock ( ) #NEWLINE# with patch . dict ( auth . AUTHENTICATION_POLICIES , { #NEWLINE# #INDENT# 'mytype' : mock_setup , #NEWLINE# #UNINDENT# } ) : #NEWLINE# #INDENT# auth . setup_auth_policies ( scheme , raml_data ) #NEWLINE# #UNINDENT# mock_setup . assert_called_once_with ( config , { #NEWLINE# #INDENT# 'name' : 'user1' , #NEWLINE# #UNINDENT# } ) #NEWLINE# config . set_authentication_policy . assert_called_once_with ( mock_setup ( ) ) #NEWLINE# mock_acl . assert_called_once_with ( ) #NEWLINE# config . set_authorization_policy . assert_called_once_with ( mock_acl ( ) )