From patchwork Tue Apr 30 06:02:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Axtens X-Patchwork-Id: 1092995 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44tWFf1Cyfz9s9y for ; Tue, 30 Apr 2019 16:04:38 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=axtens.net Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=axtens.net header.i=@axtens.net header.b="HcBFXNrJ"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 44tWFf08WQzDqMP for ; Tue, 30 Apr 2019 16:04:38 +1000 (AEST) X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=axtens.net (client-ip=2607:f8b0:4864:20::433; helo=mail-pf1-x433.google.com; envelope-from=dja@axtens.net; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=axtens.net Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=axtens.net header.i=@axtens.net header.b="HcBFXNrJ"; dkim-atps=neutral Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 44tWDB57PGzDqRk for ; Tue, 30 Apr 2019 16:03:22 +1000 (AEST) Received: by mail-pf1-x433.google.com with SMTP id b3so6550564pfd.1 for ; Mon, 29 Apr 2019 23:03:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axtens.net; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4bWS9szyPvj1eJs6nf65IPYEdDdZQUJupehPNTeIPQI=; b=HcBFXNrJmvxEzHkFb2aXO18URmKtJuHPP+RZquXkasGR+VEj6bmVDcFA9SW0I0iPba k2R3CwCEhmnHcNeaTv9O0vjEnHMd6DS/qJhcVLHKMT4W3jfCBN01RnfO4/SBVVO9xVHZ UzWJkOFs/PLZhXgVx1q/ns1srJn7v3NyqZd0Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4bWS9szyPvj1eJs6nf65IPYEdDdZQUJupehPNTeIPQI=; b=AOLLjn2WMtLQjFCbdjHdWvngErKrwTMVlegTI2rWquL7giZXsntyumOB3+DMlW3Nrs s4gLHzCH9gP7KfUf0JZVOQHr5YlvgsEhxX06liDtUg3zi+1Vr2e74kCvl/QH47B0/eJV d1nonEPDYxGc7+vDxkF6UexOvQaMdG2pey3N6GzpHB3p4BPSl8hNv2VBytdbDMoHby1T g17JQ4eZWu2NqGjFghTyMWuM9TN8nBU6PQBYMwiQiDo4hAJVuTLq8vrVoF/GCMYCeJdU dbayqeSxI3pKG/gMPaB4V4nb3rQsWOSQg0ILNQLL2qa1haXioPeHE3WrTzHvNYkUPzYW 5weg== X-Gm-Message-State: APjAAAVCI4mzEvS/1PIlvPMmd1nHGRMr99DsTkYI1sltiSWuILa3HFO+ m0gsyGLI+TV2OTURqY5/VFe4vChfSTY= X-Google-Smtp-Source: APXvYqzBkJofVZtsn/jVviMvFLZoANfjiPPwGsqwOD/W5GUKdR1ReQOzJ5LaHSDmyRDWIIywKQrcOw== X-Received: by 2002:a62:5fc7:: with SMTP id t190mr67654727pfb.191.1556604199825; Mon, 29 Apr 2019 23:03:19 -0700 (PDT) Received: from localhost (203-217-53-131.dyn.iinet.net.au. [203.217.53.131]) by smtp.gmail.com with ESMTPSA id t13sm28264759pgj.49.2019.04.29.23.03.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 29 Apr 2019 23:03:19 -0700 (PDT) From: Daniel Axtens To: patchwork@lists.ozlabs.org Subject: [PATCH 01/10] REST: Check.user is not read-only Date: Tue, 30 Apr 2019 16:02:59 +1000 Message-Id: <20190430060308.10432-2-dja@axtens.net> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190430060308.10432-1-dja@axtens.net> References: <20190430060308.10432-1-dja@axtens.net> MIME-Version: 1.0 X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" From: Stephen Finucane We only support 'Check' creation - not check updating. As a result, there's no real reason that the 'Check.user' field should be read-only and this is causing an issue with Django REST Framework 3.7. Simply remove the attribute and extend the tests to validate things are working as expected. Signed-off-by: Stephen Finucane Reviewed-by: Daniel Axtens Signed-off-by: Daniel Axtens (cherry picked from commit c9cc59dac70d76971a5342ca53e2b13eb93592de) Signed-off-by: Daniel Axtens --- patchwork/api/check.py | 2 +- patchwork/tests/api/test_check.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/patchwork/api/check.py b/patchwork/api/check.py index 594ecd4bfeec..d76573a528ec 100644 --- a/patchwork/api/check.py +++ b/patchwork/api/check.py @@ -46,7 +46,7 @@ class CheckSerializer(HyperlinkedModelSerializer): url = CheckHyperlinkedIdentityField('api-check-detail') patch = HiddenField(default=CurrentPatchDefault()) - user = UserSerializer(read_only=True, default=CurrentUserDefault()) + user = UserSerializer(default=CurrentUserDefault()) def run_validation(self, data): for val, label in Check.STATE_CHOICES: diff --git a/patchwork/tests/api/test_check.py b/patchwork/tests/api/test_check.py index bc06e86e5bb3..f5a8eca155a9 100644 --- a/patchwork/tests/api/test_check.py +++ b/patchwork/tests/api/test_check.py @@ -67,6 +67,7 @@ class TestCheckAPI(APITestCase): self.assertEqual(check_obj.target_url, check_json['target_url']) self.assertEqual(check_obj.context, check_json['context']) self.assertEqual(check_obj.description, check_json['description']) + self.assertEqual(check_obj.user.id, check_json['user']['id']) def test_list(self): """Validate we can list checks on a patch."""