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
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
def test_update_sets_response_type(self, auth_client, form_post, pyramid_request, grant_type, expected_type): pyramid_request.POST = form_post pyramid_request.POST["grant_type"] = grant_type controller = AuthClientEditController(sentinel.context, pyramid_request) controller.update() assert auth_client.response_type == expected_type
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)
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)
def test_update_updates_auth_client(self, auth_client, form_post, pyramid_request): form_post["client_id"] = auth_client.id form_post["client_secret"] = auth_client.secret pyramid_request.POST = form_post controller = AuthClientEditController(sentinel.context, pyramid_request) response = controller.update() assert auth_client.name == "new-name" assert response["form"] == self._expected_form(auth_client)
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)
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)
def test_update_does_not_update_read_only_fields(self, auth_client, form_post, pyramid_request): # Attempt to modify read-only ID and secret fields. old_id = auth_client.id old_secret = auth_client.secret form_post["client_id"] = "new-id" form_post["client_secret"] = "new-secret" pyramid_request.POST = form_post controller = AuthClientEditController(sentinel.context, pyramid_request) response = controller.update() assert auth_client.id == old_id assert auth_client.secret == old_secret assert response["form"] == self._expected_form(auth_client)