示例#1
0
    def test_update_sets_response_type(self, authclient, form_post, pyramid_request,
                                       grant_type, expected_response_type):
        pyramid_request.POST = form_post
        pyramid_request.POST['grant_type'] = grant_type
        ctrl = AuthClientEditController(authclient, pyramid_request)

        ctrl.update()

        assert authclient.response_type == expected_response_type
示例#2
0
    def test_update_sets_response_type(self, authclient, form_post, pyramid_request,
                                       grant_type, expected_response_type):
        pyramid_request.POST = form_post
        pyramid_request.POST['grant_type'] = grant_type
        ctrl = AuthClientEditController(authclient, pyramid_request)

        ctrl.update()

        assert authclient.response_type == expected_response_type
示例#3
0
    def test_update_updates_authclient(self, authclient, form_post, pyramid_request):
        form_post['client_id'] = authclient.id
        form_post['client_secret'] = authclient.secret
        pyramid_request.POST = form_post
        ctrl = AuthClientEditController(authclient, pyramid_request)

        ctx = ctrl.update()

        assert authclient.name == 'new-name'
        assert ctx['form'] == self._expected_form(authclient)
示例#4
0
    def test_update_updates_authclient(self, authclient, form_post, pyramid_request):
        form_post['client_id'] = authclient.id
        form_post['client_secret'] = authclient.secret
        pyramid_request.POST = form_post
        ctrl = AuthClientEditController(authclient, pyramid_request)

        ctx = ctrl.update()

        assert authclient.name == 'new-name'
        assert ctx['form'] == self._expected_form(authclient)
示例#5
0
    def test_update_does_not_update_read_only_fields(self, authclient, form_post, pyramid_request):
        # Attempt to modify read-only ID and secret fields.
        old_id = authclient.id
        old_secret = authclient.secret
        form_post['client_id'] = 'new-id'
        form_post['client_secret'] = 'new-secret'
        pyramid_request.POST = form_post
        ctrl = AuthClientEditController(authclient, pyramid_request)

        ctx = ctrl.update()

        assert authclient.id == old_id
        assert authclient.secret == old_secret
        assert ctx['form'] == self._expected_form(authclient)
示例#6
0
    def test_update_does_not_update_read_only_fields(self, authclient, form_post, pyramid_request):
        # Attempt to modify read-only ID and secret fields.
        old_id = authclient.id
        old_secret = authclient.secret
        form_post['client_id'] = 'new-id'
        form_post['client_secret'] = 'new-secret'
        pyramid_request.POST = form_post
        ctrl = AuthClientEditController(authclient, pyramid_request)

        ctx = ctrl.update()

        assert authclient.id == old_id
        assert authclient.secret == old_secret
        assert ctx['form'] == self._expected_form(authclient)