#NEWLINE# def test_project_filter_by_owner( self ) : #NEWLINE# #INDENT# self . _project_create ( ) #NEWLINE# alice_data = { #NEWLINE# #INDENT# 'username' : 'alice' , #NEWLINE# 'email' : 'alice@localhost.com' , #NEWLINE# #UNINDENT# } #NEWLINE# self . _login_user_and_profile ( alice_data ) #NEWLINE# ReadOnlyRole . add ( self . user , self . project ) #NEWLINE# view = ProjectViewSet . as_view ( { #NEWLINE# #INDENT# 'get' : 'retrieve' , #NEWLINE# #UNINDENT# } ) #NEWLINE# request = self . factory . get ( '/' , ** self . extra ) #NEWLINE# response = view ( request , pk = self . project . pk ) #NEWLINE# updated_project_data = response . data #NEWLINE# self . _project_create ( { #NEWLINE# #INDENT# 'name' : 'another project' , #NEWLINE# #UNINDENT# } ) #NEWLINE# request = self . factory . get ( '/' , ** self . extra ) #NEWLINE# response = self . view ( request ) #NEWLINE# self . assertEqual ( response . status_code , 200 ) #NEWLINE# self . assertIn ( updated_project_data , response . data ) #NEWLINE# self . assertIn ( self . project_data , response . data ) #NEWLINE# request = self . factory . get ( '/' , { #NEWLINE# #INDENT# 'owner' : 'bob' , #NEWLINE# #UNINDENT# } , ** self . extra ) #NEWLINE# response = self . view ( request ) #NEWLINE# self . assertEqual ( response . status_code , 200 ) #NEWLINE# self . assertIn ( updated_project_data , response . data ) #NEWLINE# self . assertNotIn ( self . project_data , response . data ) #NEWLINE# request = self . factory . get ( '/' , { #NEWLINE# #INDENT# 'owner' : 'alice' , #NEWLINE# #UNINDENT# } , ** self . extra ) #NEWLINE# response = self . view ( request ) #NEWLINE# self . assertEqual ( response . status_code , 200 ) #NEWLINE# self . assertNotIn ( updated_project_data , response . data ) #NEWLINE# self . assertIn ( self . project_data , response . data ) #NEWLINE# request = self . factory . get ( '/' , { #NEWLINE# #INDENT# 'owner' : 'noone' , #NEWLINE# #UNINDENT# } , ** self . extra ) #NEWLINE# response = self . view ( request ) #NEWLINE# self . assertEqual ( response . status_code , 200 ) #NEWLINE# self . assertEqual ( response . data , [ ] )