#NEWLINE# def test_role_for_org_non_owner( self ) : #NEWLINE# #INDENT# self . _org_create ( ) #NEWLINE# view = OrganizationProfileViewSet . as_view ( { #NEWLINE# #INDENT# 'get' : 'retrieve' , #NEWLINE# 'post' : 'members' , #NEWLINE# #UNINDENT# } ) #NEWLINE# User . objects . create ( username = 'aboy' ) #NEWLINE# data = { #NEWLINE# #INDENT# 'username' : 'aboy' , #NEWLINE# #UNINDENT# } #NEWLINE# user_role = 'member' #NEWLINE# request = self . factory . post ( '/' , data = json . dumps ( data ) , content_type = 'application/json' , ** self . extra ) #NEWLINE# response = view ( request , user = 'denoinc' ) #NEWLINE# request = self . factory . get ( '/' , ** self . extra ) #NEWLINE# response = view ( request , user = 'denoinc' ) #NEWLINE# self . assertEqual ( response . status_code , 200 ) #NEWLINE# self . assertIn ( 'users' , response . data . keys ( ) ) #NEWLINE# for user in response . data [ 'users' ] : #NEWLINE# #INDENT# username = user [ 'user' ] #NEWLINE# role = user [ 'role' ] #NEWLINE# expected_role = ( 'owner' if ( username == 'denoinc' ) else user_role ) #NEWLINE# self . assertEqual ( role , expected_role )