From nobody Sun Dec 22 01:14:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=patchew-devel-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=patchew-devel-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=bytedance.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1644926306186750.5004002969787; Tue, 15 Feb 2022 03:58:26 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-118-7R4jNXFEPFSA0WZ2_HGlBQ-1; Tue, 15 Feb 2022 06:58:21 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D548B344B0; Tue, 15 Feb 2022 11:58:20 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CBFAB6E194; Tue, 15 Feb 2022 11:58:20 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id C3FFA4BB7C; Tue, 15 Feb 2022 11:58:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 21FBwIEu019354 for ; Tue, 15 Feb 2022 06:58:19 -0500 Received: by smtp.corp.redhat.com (Postfix) id DFB13C50954; Tue, 15 Feb 2022 11:58:18 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DB907C5094F for ; Tue, 15 Feb 2022 11:58:18 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C1AFB18E5380 for ; Tue, 15 Feb 2022 11:58:18 +0000 (UTC) Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-192-h5kLqsNDNkeEzAOiJ3VaBA-1; Tue, 15 Feb 2022 06:57:59 -0500 Received: by mail-wr1-f50.google.com with SMTP id h6so31673341wrb.9 for ; Tue, 15 Feb 2022 03:57:59 -0800 (PST) Received: from localhost ([46.69.19.210]) by smtp.gmail.com with ESMTPSA id i2sm19180967wmq.45.2022.02.15.03.57.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Feb 2022 03:57:58 -0800 (PST) X-MC-Unique: 7R4jNXFEPFSA0WZ2_HGlBQ-1 X-MC-Unique: h5kLqsNDNkeEzAOiJ3VaBA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=F2eqYkbPyWv0BLVVz6Fy0Rrc6ekQdNEsj2yiAl3JwSk=; b=uV7War0vTc5E+BhtmfSdT5QPN4mqw+qlrJIddujg0Pb2buMReKkr0sXbtN3udFZGZR kpvdPfVdjGB7Pl1p8OHgKiCBfPbuNxIGBUBiXYJdFvZDZ7IopjY/PmiJIAYaRCif1Kd1 IBiDfif5Als7W5VQtRw6hKfaUIsO+Dz0wS82gZR4a7jGrmdTj9VuhnUnHDbmKKk94xy6 X99l6FxMhN7sOb3ZWEin6RnJb0uBrjlIM6yIi70V1VXVw5O1XDSiLrJRKLgR0hdhkErI fmpW6m2EzBlc0T9bKRd2Gon8dou/Ym0gK4c20otB033z3oHfWKz+IuOatwt6+e3czqp3 Jw1w== X-Gm-Message-State: AOAM530XTxKeHR2QvEKK2diNqEgiGTYUCzx8ma272wnFM+uZEbPwYbgW edm/ftPtqj33VUS8ZMq9R90ez00GjeE5dQ== X-Google-Smtp-Source: ABdhPJwePq/abF4fvDITeOnRD11LdODGiaxDp91b+wuNUPG2U7WIXYZNbAtMtUI+38JWPqyj3icjUw== X-Received: by 2002:a05:6000:2cc:: with SMTP id o12mr3096068wry.371.1644926278383; Tue, 15 Feb 2022 03:57:58 -0800 (PST) From: Fam Zheng To: patchew-devel@redhat.com Date: Tue, 15 Feb 2022 11:57:55 +0000 Message-Id: <20220215115756.3013086-2-fam.zheng@bytedance.com> In-Reply-To: <20220215115756.3013086-1-fam.zheng@bytedance.com> References: <20220215115756.3013086-1-fam.zheng@bytedance.com> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 X-loop: patchew-devel@redhat.com Cc: Fam Zheng Subject: [Patchew-devel] [PATCH 1/2] tests: Don't assume result order in rest test X-BeenThere: patchew-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Patchew development and discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: patchew-devel-bounces@redhat.com Errors-To: patchew-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=patchew-devel-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1644926308125100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Fam Zheng --- tests/test_rest.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/test_rest.py b/tests/test_rest.py index cceda69..ccaeca4 100755 --- a/tests/test_rest.py +++ b/tests/test_rest.py @@ -411,18 +411,18 @@ class RestTest(PatchewTestCase): =20 resp =3D self.api_client.get(self.REST_BASE + "series/?q=3Dproject= :QEMU") self.assertEqual(resp.data["count"], 2) - self.assertEqual( - resp.data["results"][0]["resource_uri"], resp1.data["resource_= uri"] - ) - self.assertEqual(resp.data["results"][0]["subject"], resp1.data["s= ubject"]) - self.assertEqual("replies" in resp.data["results"][0], False) - self.assertEqual("patches" in resp.data["results"][0], False) - self.assertEqual( - resp.data["results"][1]["resource_uri"], resp2.data["resource_= uri"] - ) - self.assertEqual(resp.data["results"][1]["subject"], resp2.data["s= ubject"]) - self.assertEqual("replies" in resp.data["results"][1], False) - self.assertEqual("patches" in resp.data["results"][1], False) + + def cmp_result(a, expected): + self.assertEqual(a["resource_uri"], expected["resource_uri"]) + self.assertEqual(a["subject"], expected["subject"]) + self.assertNotIn("replies", a) + self.assertNotIn("patches", a) + if resp.data["results"][0]["subject"] =3D=3D resp1.data["subject"]: + cmp_result(resp.data['results'][0], resp1.data) + cmp_result(resp.data['results'][1], resp2.data) + else: + cmp_result(resp.data['results'][0], resp2.data) + cmp_result(resp.data['results'][1], resp1.data) =20 resp =3D self.api_client.get(self.REST_BASE + "projects/12345/seri= es/?q=3Dquorum") self.assertEqual(resp.status_code, 404) --=20 2.25.1 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://listman.redhat.com/mailman/listinfo/patchew-devel