From nobody Mon Dec 15 23:50:43 2025 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 1520241403110115.59299665404626; Mon, 5 Mar 2018 01:16:43 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 910DA272B4; Mon, 5 Mar 2018 04:16:42 -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 V2SbLpPxNlML; Mon, 5 Mar 2018 04:16:42 -0500 (EST) Received: from turing.freelists.org (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 45F2226402; Mon, 5 Mar 2018 04:16:42 -0500 (EST) Received: with ECARTIS (v1.0.0; list patchew-devel); Mon, 05 Mar 2018 04:16:42 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 1202E272B4 for ; Mon, 5 Mar 2018 04:16:42 -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 auSPn4wZKysV for ; Mon, 5 Mar 2018 04:16:42 -0500 (EST) Received: from mail-wr0-f196.google.com (mail-wr0-f196.google.com [209.85.128.196]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id A1D1926402 for ; Mon, 5 Mar 2018 04:16:41 -0500 (EST) Received: by mail-wr0-f196.google.com with SMTP id v111so16404269wrb.3 for ; Mon, 05 Mar 2018 01:16:41 -0800 (PST) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id b68sm7018546wmi.30.2018.03.05.01.16.38 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 05 Mar 2018 01:16:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=freelists.org; s=turing; t=1520241402; bh=Tt9L8lG7YcBoqGyo8Cv82Mvlz9exrdPCwBWbjIydAxw=; h=From:To:Subject:Date:In-Reply-To:References:Reply-To:List-help: List-unsubscribe:List-Id:List-subscribe:List-owner:List-post: List-archive; b=k/dIQZCmmOKv3BlOcORSUBM97hOhBb6xM2MObiZ8bfVKRNT+xoaT2FNRX7QF5k4/Q D8N2achxy3lK9K8uxocusr5NQvv4IALNS7Qd3nasjpaaBSm+FWr+389INf46CjZpeB TD0CFckGq2AUb8v9RrFwV9GFFK8I0gvk2oEw0L+I= 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=1520241402; bh=Tt9L8lG7YcBoqGyo8Cv82Mvlz9exrdPCwBWbjIydAxw=; h=From:To:Subject:Date:In-Reply-To:References:Reply-To:List-help: List-unsubscribe:List-Id:List-subscribe:List-owner:List-post: List-archive; b=k/dIQZCmmOKv3BlOcORSUBM97hOhBb6xM2MObiZ8bfVKRNT+xoaT2FNRX7QF5k4/Q D8N2achxy3lK9K8uxocusr5NQvv4IALNS7Qd3nasjpaaBSm+FWr+389INf46CjZpeB TD0CFckGq2AUb8v9RrFwV9GFFK8I0gvk2oEw0L+I= X-Original-To: patchew-devel@freelists.org X-Virus-Scanned: Debian amavisd-new at turing.freelists.org X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=6SS+eRxV+FjaSJ+Z5pyY0IIgQ5JkKuYDd0OYA/PjVBQ=; b=dSxBVhXN94g6EANaiFB1/1Qp2aZ9Ux8GwMqLC48/Qslx2nud4MviwfYPFQB5exaAOj fNdcWKgYsHVUfU2fUw166QMaQrrzUGT+NtKrJu5NTReBByFf+mLnRiyxeYg6ZQkAKta8 qUwsWSmjeuBBguRqojzjnC65Ou7ZWFsF6CrOTly7OLGwFocIu6QyquslXPA37Z20OmSM md0ioWZPzuWZiEw3DG9K4gdZW7VpvcneXQkXiRTVeUqX23qHcmCoTW/3982EnXyJRNbz hlGYr/lkcnobjwiR3NwHSg63ktv5XmNtyzheVosKlHTOV1I9qpdpEcCk9Xrr/4FKxLCS LSRA== X-Gm-Message-State: APf1xPAA2YqrzvkQ9m3c0x7c8PTKcK82drT0t1THb11brTemjdGEVT1i aEuyeSyDrdFqFiTzXGK4ptombs4a X-Google-Smtp-Source: AG47ELtm+GqohTltMyeJCnM0ZUEka4TTKq3wm/ZU3jGZftPFAmwseuf+Fl3YkVRuRnwkMIlbyVU8tQ== X-Received: by 10.223.169.161 with SMTP id b30mr13228655wrd.232.1520241399798; Mon, 05 Mar 2018 01:16:39 -0800 (PST) From: Paolo Bonzini To: patchew-devel@freelists.org Subject: [patchew-devel] [PATCH 5/6] testing: add reverse_testing_log Date: Mon, 5 Mar 2018 10:16:33 +0100 Message-Id: <20180305091634.7391-6-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180305091634.7391-1-pbonzini@redhat.com> References: <20180305091634.7391-1-pbonzini@redhat.com> X-archive-position: 77 X-ecartis-version: Ecartis v1.0.0 Sender: patchew-devel-bounce@freelists.org Errors-to: patchew-devel-bounce@freelists.org X-original-sender: pbonzini@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" Abstract the creation of testing log URLs. Signed-off-by: Paolo Bonzini --- mods/testing.py | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/mods/testing.py b/mods/testing.py index 47933e2..7125d58 100644 --- a/mods/testing.py +++ b/mods/testing.py @@ -146,6 +146,24 @@ class TestingModule(PatchewModule): TestingLogViewer.as_view(), name=3D"testing-log")) =20 + def reverse_testing_log(self, obj, test, request=3DNone, html=3DFalse): + if isinstance(obj, Message): + log_url =3D reverse("testing-log", + kwargs=3D{"project_or_series": obj.message_i= d, + "testing_name": test}) + "?type=3Dme= ssage" + else: + assert(isinstance(obj, Project)) + log_url =3D reverse.reverse("testing-log", + kwargs=3D{"project_or_series": obj.name, + "testing_name": test}) + "?type=3Dpr= oject" + if html: + log_url +=3D "&html=3D1" + # Generate a full URL, including the host and port, for use in ema= il + # notifications and REST API responses. + if request: + log_url =3D request.build_absolute_uri(url) + return log_url + def add_test_report(self, user, project, tester, test, head, base, identity, passed, log, is_timeout): # Find a project or series depending on the test type and assign i= t to obj @@ -203,20 +221,8 @@ class TestingModule(PatchewModule): continue tn =3D pn[len("testing.report."):] failed =3D not p["passed"] - log_prop =3D "testing.log." + tn - if isinstance(obj, Message): - typearg =3D "type=3Dmessage" - log_url =3D reverse("testing-log", - kwargs=3D{"project_or_series": obj.messa= ge_id, - "testing_name": tn}) - else: - assert(isinstance(obj, Project)) - typearg =3D "type=3Dproject" - log_url =3D reverse("testing-log", - kwargs=3D{"project_or_series": obj.name, - "testing_name": tn}) - log_url +=3D "?" + typearg - html_log_url =3D log_url + "&html=3D1" + log_url =3D self.reverse_testing_log(obj, tn, html=3DFalse) + html_log_url =3D self.reverse_testing_log(obj, tn, html=3DTrue) passed_str =3D "failed" if failed else "passed" html =3D format_html('Test {} {}', tn, html_log_url, log_url, passed_str) @@ -263,12 +269,7 @@ class TestingModule(PatchewModule): continue tn =3D pn[len("testing.report."):] failed =3D not p["passed"] - log_prop =3D "testing.log." + tn - typearg =3D "type=3Dmessage" - log_url =3D reverse("testing-log", - kwargs=3D{"project_or_series": message.messa= ge_id, - "testing_name": tn}) - log_url +=3D "?" + typearg + log_url =3D self.reverse_testing_log(message, tn, request=3Dre= quest, html=3DFalse) passed_str =3D "failure" if failed else "success" result =3D { 'status': passed_str, --=20 2.14.3