Beispiel #1
0
    def test_post_sets_group_properties(
        self, form_validating_to, pyramid_request, group
    ):
        controller = views.GroupEditController(GroupContext(group), pyramid_request)
        controller.form = form_validating_to(
            {"name": "New name", "description": "New description"}
        )
        controller.post()

        assert group.name == "New name"
        assert group.description == "New description"
Beispiel #2
0
    def test_get_reads_group_properties(self, pyramid_request, group):
        pyramid_request.create_form.return_value = FakeForm()

        result = views.GroupEditController(GroupContext(group), pyramid_request).get()

        assert result == {
            "form": {
                "name": group.name,
                "description": group.description,
            },
            "group_path": f"/g/{group.pubid}/{group.slug}",
        }
Beispiel #3
0
    def test_post_sets_group_properties(self, form_validating_to, pyramid_request):
        creator = User(username='******', authority='example.org')
        group = Group(name='Birdwatcher Community',
                      authority='foobar.com',
                      description='We watch birds all day long',
                      creator=creator)
        group.pubid = 'the-test-pubid'

        controller = views.GroupEditController(group, pyramid_request)
        controller.form = form_validating_to({
            'name': 'Alligatorwatcher Comm.',
            'description': 'We are all about the alligators now',
        })
        controller.post()

        assert group.name == 'Alligatorwatcher Comm.'
        assert group.description == 'We are all about the alligators now'
Beispiel #4
0
    def test_get_reads_group_properties(self, pyramid_request):
        pyramid_request.create_form.return_value = FakeForm()

        creator = User(username='******', authority='example.org')
        group = Group(name='Birdwatcher Community',
                      description='We watch birds all day long',
                      creator=creator)
        group.pubid = 'the-test-pubid'

        result = views.GroupEditController(group, pyramid_request).get()

        assert result == {
            'form': {
                'name': 'Birdwatcher Community',
                'description': 'We watch birds all day long',
            },
            'group_path': '/g/the-test-pubid/birdwatcher-community'
        }
Beispiel #5
0
    def test_get_reads_group_properties(self, pyramid_request):
        pyramid_request.create_form.return_value = FakeForm()

        creator = User(username="******", authority="example.org")
        group = Group(
            name="Birdwatcher Community",
            authority="foobar.com",
            description="We watch birds all day long",
            creator=creator,
        )
        group.pubid = "the-test-pubid"

        result = views.GroupEditController(group, pyramid_request).get()

        assert result == {
            "form": {
                "name": "Birdwatcher Community",
                "description": "We watch birds all day long",
            },
            "group_path": "/g/the-test-pubid/birdwatcher-community",
        }
Beispiel #6
0
    def test_post_sets_group_properties(self, form_validating_to,
                                        pyramid_request):
        creator = User(username="******", authority="example.org")
        group = Group(
            name="Birdwatcher Community",
            authority="foobar.com",
            description="We watch birds all day long",
            creator=creator,
        )
        group.pubid = "the-test-pubid"

        controller = views.GroupEditController(group, pyramid_request)
        controller.form = form_validating_to({
            "name":
            "Alligatorwatcher Comm.",
            "description":
            "We are all about the alligators now",
        })
        controller.post()

        assert group.name == "Alligatorwatcher Comm."
        assert group.description == "We are all about the alligators now"