#NEWLINE# def test_project_top_contributors( self ) : #NEWLINE# #INDENT# '\n        Tests if view returns top contributors specific for given project.\n        ' #NEWLINE# first_project = ProjectFactory . create ( ) #NEWLINE# ResourceFactory . create ( project = first_project ) #NEWLINE# first_project_contributor = TranslationFactory . create ( entity__resource__project = first_project ) . user #NEWLINE# second_project = ProjectFactory . create ( ) #NEWLINE# ResourceFactory . create ( project = second_project ) #NEWLINE# second_project_contributor = TranslationFactory . create ( entity__resource__project = second_project ) . user #NEWLINE# with patch . object ( views . ProjectContributorsView , 'render_to_response' , return_value = HttpResponse ( '' ) ) as mock_render : #NEWLINE# #INDENT# self . client . get ( '/projects/{}/contributors/' . format ( first_project . slug ) ) #NEWLINE# assert_equal ( mock_render . call_args [ 0 ] [ 0 ] [ 'project' ] , first_project ) #NEWLINE# assert_equal ( list ( mock_render . call_args [ 0 ] [ 0 ] [ 'contributors' ] ) , [ first_project_contributor ] ) #NEWLINE# self . client . get ( '/projects/{}/contributors/' . format ( second_project . slug ) ) #NEWLINE# assert_equal ( mock_render . call_args [ 0 ] [ 0 ] [ 'project' ] , second_project ) #NEWLINE# assert_equal ( list ( mock_render . call_args [ 0 ] [ 0 ] [ 'contributors' ] ) , [ second_project_contributor ] )