def test_it_proxies_to_group_list_service( self, pyramid_request, group_list_service ): views.profile_groups(pyramid_request) group_list_service.user_groups.assert_called_once_with( user=pyramid_request.user )
def test_it_proxies_expand_to_presenter(self, pyramid_request, group_list_service, GroupsJSONPresenter): pyramid_request.params["expand"] = "organization" group_list_service.user_groups.return_value = [1, 2, 3] views.profile_groups(pyramid_request) GroupsJSONPresenter( [1, 2, 3]).asdicts.assert_called_once_with(expand=["organization"])
def test_it_converts_group_models_to_contexts(self, pyramid_request, group_list_service, GroupContext): group_list_service.user_groups.return_value = [1, 2, 3] views.profile_groups(pyramid_request) GroupContext.assert_has_calls([ mock.call(1, pyramid_request), mock.call(2, pyramid_request), mock.call(3, pyramid_request), ])
def test_it_proxies_expand_to_presenter( self, pyramid_request, group_list_service, GroupsJSONPresenter ): pyramid_request.params["expand"] = "organization" group_list_service.user_groups.return_value = [1, 2, 3] views.profile_groups(pyramid_request) GroupsJSONPresenter([1, 2, 3]).asdicts.assert_called_once_with( expand=["organization"] )
def test_it_converts_group_models_to_contexts( self, pyramid_request, group_list_service, GroupContext ): group_list_service.user_groups.return_value = [1, 2, 3] views.profile_groups(pyramid_request) GroupContext.assert_has_calls( [ mock.call(1, pyramid_request), mock.call(2, pyramid_request), mock.call(3, pyramid_request), ] )
def test_it_returns_presented_groups(self, pyramid_request, group_list_service, GroupsJSONPresenter): group_list_service.user_groups.return_value = [1, 2, 3] result = views.profile_groups(pyramid_request) assert result == GroupsJSONPresenter([1, 2, 3]).asdicts.return_value
def test_it_returns_presented_groups( self, pyramid_request, group_list_service, GroupsJSONPresenter ): group_list_service.user_groups.return_value = [1, 2, 3] result = views.profile_groups(pyramid_request) assert result == GroupsJSONPresenter([1, 2, 3]).asdicts.return_value
def test_it(self, pyramid_request, expand, group_list_service, GroupsJSONPresenter): for param in expand: pyramid_request.GET.add("expand", param) result = views.profile_groups(pyramid_request) group_list_service.user_groups.assert_called_once_with( user=pyramid_request.user) GroupsJSONPresenter.assert_called_once_with( group_list_service.user_groups.return_value, pyramid_request) GroupsJSONPresenter.return_value.asdicts.assert_called_once_with( expand=expand) assert result == GroupsJSONPresenter.return_value.asdicts.return_value
def test_it_proxies_to_group_list_service(self, pyramid_request, group_list_service): views.profile_groups(pyramid_request) group_list_service.user_groups.assert_called_once_with( user=pyramid_request.user)