From nobody Mon Sep 16 18:57:32 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 206.53.239.180 is neither permitted nor denied by domain of freelists.org) client-ip=206.53.239.180; envelope-from=patchew-devel-bounce@freelists.org; helo=turing.freelists.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=none (zoho.com: 206.53.239.180 is neither permitted nor denied by domain of freelists.org) smtp.mailfrom=patchew-devel-bounce@freelists.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from turing.freelists.org (turing.freelists.org [206.53.239.180]) by mx.zohomail.com with SMTPS id 1519369203130411.27421959803996; Thu, 22 Feb 2018 23:00:03 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 8C3A92876A; Fri, 23 Feb 2018 02:00:02 -0500 (EST) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FZCiKAUyrQFz; Fri, 23 Feb 2018 02:00:02 -0500 (EST) Received: from turing.freelists.org (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 45F152820E; Fri, 23 Feb 2018 02:00:02 -0500 (EST) Received: with ECARTIS (v1.0.0; list patchew-devel); Fri, 23 Feb 2018 02:00:02 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 19A712876A for ; Fri, 23 Feb 2018 02:00:02 -0500 (EST) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aByIW6SAoWq3 for ; Fri, 23 Feb 2018 02:00:02 -0500 (EST) Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id E5CA72820E for ; Fri, 23 Feb 2018 02:00:01 -0500 (EST) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8AF75818B10E for ; Fri, 23 Feb 2018 07:00:01 +0000 (UTC) Received: from lemon.usersys.redhat.com (ovpn-12-21.pek2.redhat.com [10.72.12.21]) by smtp.corp.redhat.com (Postfix) with ESMTP id 76D622024CA9; Fri, 23 Feb 2018 06:59:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=freelists.org; s=turing; t=1519369202; bh=ltDRhmT4BaPwTwnWz7/58mXCK3WOFUhF6xqkgtDYhdw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:Reply-To:List-help: List-unsubscribe:List-Id:List-subscribe:List-owner:List-post: List-archive; b=WMyo2hrjNA98HgCNxS8AjlBRoBNvLuerpfENmkVjAyTxuUAK+kayHCDlXulG2AQ/a rtaYbbSldFhYGKGzKl77E8lS/d7/IhBRnAxGUjRkoL7H/v4FPNBVTxorUwdb5gXDdv 9RgMIW2A8ruGT35BtRA/NF103vrCuDbQqQ0iN5SA= X-Virus-Scanned: Debian amavisd-new at turing.freelists.org DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=freelists.org; s=turing; t=1519369202; bh=ltDRhmT4BaPwTwnWz7/58mXCK3WOFUhF6xqkgtDYhdw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:Reply-To:List-help: List-unsubscribe:List-Id:List-subscribe:List-owner:List-post: List-archive; b=WMyo2hrjNA98HgCNxS8AjlBRoBNvLuerpfENmkVjAyTxuUAK+kayHCDlXulG2AQ/a rtaYbbSldFhYGKGzKl77E8lS/d7/IhBRnAxGUjRkoL7H/v4FPNBVTxorUwdb5gXDdv 9RgMIW2A8ruGT35BtRA/NF103vrCuDbQqQ0iN5SA= X-Original-To: patchew-devel@freelists.org X-Virus-Scanned: Debian amavisd-new at turing.freelists.org From: Fam Zheng To: patchew-devel@freelists.org Cc: pbonzini@redhat.com, famz@redhat.com Subject: [patchew-devel] [PATCH v4 3/3] tests: Add basic tests for subprojects Date: Fri, 23 Feb 2018 14:59:43 +0800 Message-Id: <20180223065943.15251-4-famz@redhat.com> In-Reply-To: <20180223065943.15251-1-famz@redhat.com> References: <20180223065943.15251-1-famz@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Fri, 23 Feb 2018 07:00:01 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Fri, 23 Feb 2018 07:00:01 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'famz@redhat.com' RCPT:'' X-archive-position: 32 X-ecartis-version: Ecartis v1.0.0 Sender: patchew-devel-bounce@freelists.org Errors-to: patchew-devel-bounce@freelists.org X-original-sender: famz@redhat.com Precedence: normal Reply-To: patchew-devel@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: patchew-devel X-List-ID: patchew-devel List-subscribe: List-owner: List-post: List-archive: X-list: patchew-devel X-ZohoMail-DKIM: pass (identity @freelists.org) X-ZohoMail: RDKM_0 RSF_4 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Fam Zheng --- tests/test_rest.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/tests/test_rest.py b/tests/test_rest.py index b96ecee..19b5cc0 100755 --- a/tests/test_rest.py +++ b/tests/test_rest.py @@ -27,6 +27,11 @@ class RestTest(PatchewTestCase): self.p =3D self.add_project("QEMU", "qemu-devel@nongnu.org") self.PROJECT_BASE =3D '%sprojects/%d/' % (self.REST_BASE, self.p.i= d) =20 + self.sp =3D self.add_project("QEMU Block Layer", "qemu-block@nongn= u.org") + self.sp.parent_project =3D self.p + self.sp.save() + self.SUBPROJECT_BASE =3D '%sprojects/%d/' % (self.REST_BASE, self.= sp.id) + self.admin =3D User.objects.get(username=3D'admin') self.USER_BASE =3D '%susers/%d/' % (self.REST_BASE, self.admin.id) =20 @@ -43,16 +48,25 @@ class RestTest(PatchewTestCase): =20 def test_projects(self): resp =3D self.api_client.get(self.REST_BASE + 'projects/') - self.assertEquals(resp.data['count'], 1) + self.assertEquals(resp.data['count'], 2) self.assertEquals(resp.data['results'][0]['resource_uri'], self.PR= OJECT_BASE) self.assertEquals(resp.data['results'][0]['name'], "QEMU") self.assertEquals(resp.data['results'][0]['mailing_list'], "qemu-d= evel@nongnu.org") + self.assertEquals(resp.data['results'][1]['resource_uri'], self.SU= BPROJECT_BASE) + self.assertEquals(resp.data['results'][1]['name'], "QEMU Block Lay= er") + self.assertEquals(resp.data['results'][1]['mailing_list'], "qemu-b= lock@nongnu.org") + self.assertEquals(resp.data['results'][1]['parent_project'], self.= PROJECT_BASE) =20 def test_project(self): resp =3D self.api_client.get(self.PROJECT_BASE) self.assertEquals(resp.data['resource_uri'], self.PROJECT_BASE) self.assertEquals(resp.data['name'], "QEMU") self.assertEquals(resp.data['mailing_list'], "qemu-devel@nongnu.or= g") + resp =3D self.api_client.get(self.SUBPROJECT_BASE) + self.assertEquals(resp.data['resource_uri'], self.SUBPROJECT_BASE) + self.assertEquals(resp.data['name'], "QEMU Block Layer") + self.assertEquals(resp.data['mailing_list'], "qemu-block@nongnu.or= g") + self.assertEquals(resp.data['parent_project'], self.PROJECT_BASE) =20 def test_project_post_minimal(self): data =3D { @@ -75,6 +89,7 @@ class RestTest(PatchewTestCase): 'git': 'https://gitlab.com/keycodemap/keycodemapdb/', 'description': 'keycodemapdb generates code to translate key c= odes', 'display_order': 4321, + 'parent_project': self.PROJECT_BASE, } resp =3D self.api_client.post(self.REST_BASE + 'projects/', data= =3Ddata) self.assertEquals(resp.status_code, 201) @@ -87,6 +102,7 @@ class RestTest(PatchewTestCase): self.assertEquals(resp.data['description'], data['description']) self.assertEquals(resp.data['display_order'], data['display_order'= ]) self.assertEquals(resp.data['logo'], None) + self.assertEquals(resp.data['parent_project'], self.PROJECT_BASE) =20 resp =3D self.api_client.get(resp.data['resource_uri']) self.assertEquals(resp.data['name'], data['name']) @@ -97,6 +113,7 @@ class RestTest(PatchewTestCase): self.assertEquals(resp.data['description'], data['description']) self.assertEquals(resp.data['display_order'], data['display_order'= ]) self.assertEquals(resp.data['logo'], None) + self.assertEquals(resp.data['parent_project'], self.PROJECT_BASE) =20 def test_series_single(self): resp =3D self.apply_and_retrieve('0001-simple-patch.mbox.gz', --=20 2.14.3