Exemple #1
0
    def test_it_creates_group_context_from_group_model(
        self, GroupContext, factories, pyramid_request
    ):
        group = factories.Group()

        views.read(group, pyramid_request)

        GroupContext.assert_called_once_with(group, pyramid_request)
Exemple #2
0
    def test_it_creates_group_context_from_group_model(
        self, GroupContext, factories, pyramid_request
    ):
        group = factories.Group()

        views.read(group, pyramid_request)

        GroupContext.assert_called_once_with(group, pyramid_request)
Exemple #3
0
    def test_it_forwards_expand_param_to_presenter(
        self, GroupJSONPresenter, factories, pyramid_request
    ):
        pyramid_request.params["expand"] = "organization"
        group = factories.Group()

        views.read(group, pyramid_request)

        GroupJSONPresenter.return_value.asdict.assert_called_once_with(["organization"])
Exemple #4
0
    def test_it_forwards_expand_param_to_presenter(
        self, GroupJSONPresenter, factories, pyramid_request
    ):
        pyramid_request.params["expand"] = "organization"
        group = factories.Group()

        views.read(group, pyramid_request)

        GroupJSONPresenter.return_value.asdict.assert_called_once_with(["organization"])
Exemple #5
0
    def test_it_returns_presented_group(self, GroupJSONPresenter, factories,
                                        pyramid_request):
        pyramid_request.params["expand"] = "organization"
        group = factories.Group()

        presented = views.read(group, pyramid_request)

        assert presented == GroupJSONPresenter.return_value.asdict.return_value
Exemple #6
0
    def test_it_returns_presented_group(
        self, GroupJSONPresenter, factories, pyramid_request
    ):
        pyramid_request.params["expand"] = "organization"
        group = factories.Group()

        presented = views.read(group, pyramid_request)

        assert presented == GroupJSONPresenter.return_value.asdict.return_value
Exemple #7
0
    def test_it(self, context, pyramid_request, GroupJSONPresenter):
        pyramid_request.params["expand"] = "organization"

        result = views.read(context, pyramid_request)

        GroupJSONPresenter.assert_called_once_with(context.group,
                                                   pyramid_request)
        GroupJSONPresenter.return_value.asdict.assert_called_once_with(
            ["organization"])
        assert result == GroupJSONPresenter.return_value.asdict.return_value