From patchwork Thu Aug 26 17:18:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Finucane X-Patchwork-Id: 1521230 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="key not found in DNS" header.d=that.guru header.i=@that.guru header.a=rsa-sha256 header.s=x header.b=Ja0lwjNX; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (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 4GwV2G6w5qz9sWX for ; Fri, 27 Aug 2021 03:19:18 +1000 (AEST) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4GwV2G5mNFz2ywF for ; Fri, 27 Aug 2021 03:19:18 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="key not found in DNS" header.d=that.guru header.i=@that.guru header.a=rsa-sha256 header.s=x header.b=Ja0lwjNX; dkim-atps=neutral X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=that.guru (client-ip=136.175.108.195; helo=mail-108-mta195.mxroute.com; envelope-from=stephen@that.guru; receiver=) Authentication-Results: lists.ozlabs.org; dkim=fail reason="key not found in DNS" header.d=that.guru header.i=@that.guru header.a=rsa-sha256 header.s=x header.b=Ja0lwjNX; dkim-atps=neutral Received: from mail-108-mta195.mxroute.com (mail-108-mta195.mxroute.com [136.175.108.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4GwV1k3bvcz2yHf for ; Fri, 27 Aug 2021 03:18:49 +1000 (AEST) Received: from filter004.mxroute.com ([149.28.56.236] filter004.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta195.mxroute.com (ZoneMTA) with ESMTPSA id 17b8378927800074ba.003 for (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES128-GCM-SHA256); Thu, 26 Aug 2021 17:18:42 +0000 X-Zone-Loop: a94c14211008c06b85942bcc3fc944146f79ef22a993 X-Originating-IP: [149.28.56.236] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=that.guru; s=x; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=TyItD6z1u9Dak/qDrBJw2AubEVow8UyKUy41e7T6aAY=; b=Ja0lwjNXVu5gT6Y8tUGKyW8DPc qwfOe9PfgwG1iGhIzhjB4hWMuYqcNyVGZxDEJCPZZQnSSpoKOQAa3mzeyLipjNJKLsFjjQCz1sTO7 aVszbuS1KvWmET8/m/Bgt/RNCX1sAaCmOUI8oZF5lCN9rxJUMmWlJ2OpdHPWi4Wluh9xqp+YYe9K+ 1GRO5b81djloLGizLVbn9zmGUIhC4Mi9cSVK4Bh9edk7oo4N5RKKipNFEvpRpHZ6s++cys7CyHL2G 0LJFKOTEA7lQvZZa1uICWSGZxql+uG0VyjcFPRVIQ3XMp8YEpufgmBu1cku7ejbyJc+u1UfJoPdlv xmxPKv4A==; From: Stephen Finucane To: patchwork@lists.ozlabs.org Subject: [PATCH 4/4] tests: Tweak comment API tests Date: Thu, 26 Aug 2021 18:18:31 +0100 Message-Id: <20210826171831.547578-5-stephen@that.guru> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210826171831.547578-1-stephen@that.guru> References: <20210826171831.547578-1-stephen@that.guru> MIME-Version: 1.0 X-AuthUser: stephen@that.guru 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" We were missing tests for 'GET /patch/{patch_id}/comment' (list patch comments) and 'GET /cover/{cover_id}/comment' (list cover comments) when using API version 1.2. In addition, we had effectively duplicated tests by including explicit tests for API 1.3. These are unnecessary since we default to testing against the latest version. Address both issues. Signed-off-by: Stephen Finucane --- patchwork/tests/api/test_comment.py | 40 ++++++++++++++++------------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git patchwork/tests/api/test_comment.py patchwork/tests/api/test_comment.py index 74acf447..5c035e82 100644 --- patchwork/tests/api/test_comment.py +++ patchwork/tests/api/test_comment.py @@ -69,6 +69,17 @@ class TestCoverComments(utils.APITestCase): self.assertEqual(1, len(resp.data)) self.assertSerialized(comment, resp.data[0]) self.assertIn('list_archive_url', resp.data[0]) + self.assertIn('addressed', resp.data[0]) + + def test_list_version_1_2(self): + """List cover letter comments using API v1.2.""" + create_cover_comment(cover=self.cover) + + resp = self.client.get(self.api_url(self.cover, version='1.2')) + self.assertEqual(status.HTTP_200_OK, resp.status_code) + self.assertEqual(1, len(resp.data)) + self.assertIn('list_archive_url', resp.data[0]) + self.assertNotIn('addressed', resp.data[0]) def test_list_version_1_1(self): """List cover letter comments using API v1.1.""" @@ -110,15 +121,6 @@ class TestCoverComments(utils.APITestCase): self.assertEqual(status.HTTP_200_OK, resp.status_code) self.assertSerialized(comment, resp.data) - def test_detail_version_1_3(self): - """Show a cover letter comment using API v1.3.""" - comment = create_cover_comment(cover=self.cover) - - resp = self.client.get( - self.api_url(self.cover, version='1.3', item=comment)) - self.assertEqual(status.HTTP_200_OK, resp.status_code) - self.assertSerialized(comment, resp.data) - def test_detail_version_1_2(self): """Show a cover letter comment using API v1.2.""" comment = create_cover_comment(cover=self.cover) @@ -292,6 +294,17 @@ class TestPatchComments(utils.APITestCase): self.assertEqual(1, len(resp.data)) self.assertSerialized(comment, resp.data[0]) self.assertIn('list_archive_url', resp.data[0]) + self.assertIn('addressed', resp.data[0]) + + def test_list_version_1_2(self): + """List patch comments using API v1.2.""" + create_patch_comment(patch=self.patch) + + resp = self.client.get(self.api_url(self.patch, version='1.2')) + self.assertEqual(status.HTTP_200_OK, resp.status_code) + self.assertEqual(1, len(resp.data)) + self.assertIn('list_archive_url', resp.data[0]) + self.assertNotIn('addressed', resp.data[0]) def test_list_version_1_1(self): """List patch comments using API v1.1.""" @@ -333,15 +346,6 @@ class TestPatchComments(utils.APITestCase): self.assertEqual(status.HTTP_200_OK, resp.status_code) self.assertSerialized(comment, resp.data) - def test_detail_version_1_3(self): - """Show a patch comment using API v1.3.""" - comment = create_patch_comment(patch=self.patch) - - resp = self.client.get( - self.api_url(self.patch, version='1.3', item=comment)) - self.assertEqual(status.HTTP_200_OK, resp.status_code) - self.assertSerialized(comment, resp.data) - def test_detail_version_1_2(self): """Show a patch comment using API v1.2.""" comment = create_patch_comment(patch=self.patch)