Example #1
0
    def test_read_renders_form_if_group_has_no_creator(self, pyramid_request, group):
        pyramid_request.matchdict = {'pubid': group.pubid}
        group.creator = None
        ctrl = GroupEditController(pyramid_request)

        ctx = ctrl.read()

        assert ctx['form'] == self._expected_form(group)
Example #2
0
    def test_read_renders_form_if_group_has_no_creator(self, pyramid_request,
                                                       group, group_svc):
        group.creator = None
        group_svc.fetch.return_value = group
        ctrl = GroupEditController(pyramid_request)

        ctx = ctrl.read()

        assert ctx['form'] == self._expected_form(group)
Example #3
0
    def test_read_renders_form(self, pyramid_request, factories, group):
        pyramid_request.matchdict = {'pubid': group.pubid}
        factories.Annotation(groupid=group.pubid)
        factories.Annotation(groupid=group.pubid)

        ctrl = GroupEditController(pyramid_request)

        ctx = ctrl.read()

        assert ctx['form'] == self._expected_form(group)
        assert ctx['pubid'] == group.pubid
        assert ctx['group_name'] == group.name
        assert ctx['member_count'] == len(group.members)
        assert ctx['annotation_count'] == 2