#NEWLINE# def test_project_share_remove_user( self ) : #NEWLINE# #INDENT# self . _project_create ( ) #NEWLINE# alice_data = { #NEWLINE# #INDENT# 'username' : 'alice' , #NEWLINE# 'email' : 'alice@localhost.com' , #NEWLINE# #UNINDENT# } #NEWLINE# alice_profile = self . _create_user_profile ( alice_data ) #NEWLINE# view = ProjectViewSet . as_view ( { #NEWLINE# #INDENT# 'post' : 'share' , #NEWLINE# #UNINDENT# } ) #NEWLINE# projectid = self . project . pk #NEWLINE# role_class = ReadOnlyRole #NEWLINE# data = { #NEWLINE# #INDENT# 'username' : 'alice' , #NEWLINE# 'role' : role_class . name , #NEWLINE# #UNINDENT# } #NEWLINE# request = self . factory . post ( '/' , data = data , ** self . extra ) #NEWLINE# response = view ( projectid , pk = projectid ) #NEWLINE# self . assertEqual ( response . status_code , 204 ) #NEWLINE# self . assertTrue ( role_class . user_has_role ( alice_profile . user , self . project ) ) #NEWLINE# view = ProjectViewSet . as_view ( { #NEWLINE# #INDENT# 'post' : 'share' , #NEWLINE# #UNINDENT# } ) #NEWLINE# data [ 'remove' ] = True #NEWLINE# request = self . factory . post ( '/' , data = data , ** self . extra ) #NEWLINE# response = view ( request , pk = projectid ) #NEWLINE# self . assertEqual ( response . status_code , 204 ) #NEWLINE# self . assertFalse ( role_class . user_has_role ( alice_profile . user , self . project ) )