From nobody Thu Mar 28 20:26:41 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=patchew-devel-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=patchew-devel-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1530870173483268.70770294704096; Fri, 6 Jul 2018 02:42:53 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D29E93082A3B; Fri, 6 Jul 2018 09:42:52 +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 C4F432010CBC; Fri, 6 Jul 2018 09:42:52 +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 B51054BB78; Fri, 6 Jul 2018 09:42:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w669gqOK011997 for ; Fri, 6 Jul 2018 05:42:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id 441EC2AFD7; Fri, 6 Jul 2018 09:42:52 +0000 (UTC) Received: from mx1.redhat.com (ext-mx18.extmail.prod.ext.phx2.redhat.com [10.5.110.47]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 33B252CFA2 for ; Fri, 6 Jul 2018 09:42:49 +0000 (UTC) Received: from mail-pf0-f195.google.com (mail-pf0-f195.google.com [209.85.192.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B8C3F30820E5 for ; Fri, 6 Jul 2018 09:42:38 +0000 (UTC) Received: by mail-pf0-f195.google.com with SMTP id j17-v6so7992609pfn.5 for ; Fri, 06 Jul 2018 02:42:38 -0700 (PDT) Received: from localhost.localdomain ([182.74.40.122]) by smtp.gmail.com with ESMTPSA id r87-v6sm15257688pfb.1.2018.07.06.02.42.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 06 Jul 2018 02:42:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=pA9h1+plKOt+mHUNRVF+QEMpRhSu3h50lxWkQkW8fE8=; b=FC9Tn6vbDF3yeF6TNR5zH2tfY320c7VBm328rvtS3mOc6R4PIL/9yQTrx1Z1zhOrsn k+9AI9gWU0Q7xeuMQMta2tnBq7MIfrRlNM1dB1ciM6kga8C9fenqKFPdWblEvzFZ+v9L lBpW2JLibt+YATbAv5/f8pKe/VtXnW0iLRufHccDafSdLNaELmlC5/dAyO7qt1DAVnfM b4N9ojf7SLQZ+RyaPQbcmMMxEy2+dc3mNIrCOvpNYJqcAPkV7ZnsewrJ2G2oFswwqMMw GTp/TJSqvRe5PZwFe/u7ATCWONDJYtfzXoOLyOFnPsrUtrORpefr00Dm9Av9/d7yZqfP x2qg== 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; bh=pA9h1+plKOt+mHUNRVF+QEMpRhSu3h50lxWkQkW8fE8=; b=E/YaAYJlKV0AFgHTBGKjaHdFIr77BaGGuIuA9tiuySUTc75TD8/5JbME7+kZBqnF0D M2K2dHvOCoSENpylK9/xc/ZlkdK/4EKSknSnOchHAIvfzPr+/Yh7uub7QmSKUVoLr48z Nq8MfqixAEcnvUITf1fkfFOA7z95ieUF7gviSdPakwEWTGOZNl4bfVr2v/4TJ7pgiKn4 k0lvZMYgMuqo+84h7SO7wlJLuhqoCsiZHLSpsdGSPeHY7+eopi/poTVmM8M9Nwh+nnMJ 9PtfW3vh7y793B6dYHjPhES2wpWZnQ1Rcye70Nc0N0JRPauLO3ewvOexCo3vd8qcYi/w D8Rg== X-Gm-Message-State: APt69E1X5zHe+xgVV3swpNAs0Kh9Ew4ZH1y8qTneY2NzUTUJ918Ah2VH EFDBSN5Bo9Xde4If/xaGfnFdfA== X-Google-Smtp-Source: AAOMgpdViZCnvwyAO2Klhrrs0zXK0ksWcQBCim8C4fywYG7wiE12jYCCl4gZdmTet3bns3Kl7E+AfA== X-Received: by 2002:a63:3201:: with SMTP id y1-v6mr8902539pgy.419.1530870157757; Fri, 06 Jul 2018 02:42:37 -0700 (PDT) From: Shubham Jain To: patchew-devel@redhat.com Date: Fri, 6 Jul 2018 15:09:44 +0530 Message-Id: <20180706093947.20025-2-shubhamjain7495@gmail.com> In-Reply-To: <20180706093947.20025-1-shubhamjain7495@gmail.com> References: <20180706093947.20025-1-shubhamjain7495@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Fri, 06 Jul 2018 09:42:38 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Fri, 06 Jul 2018 09:42:38 +0000 (UTC) for IP:'209.85.192.195' DOMAIN:'mail-pf0-f195.google.com' HELO:'mail-pf0-f195.google.com' FROM:'shubhamjain7495@gmail.com' RCPT:'' X-RedHat-Spam-Score: 1.55 * (DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, NML_ADSP_CUSTOM_MED, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_PASS, T_DKIM_INVALID) 209.85.192.195 mail-pf0-f195.google.com 209.85.192.195 mail-pf0-f195.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.47 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: patchew-devel@redhat.com Cc: Shubham Jain Subject: [Patchew-devel] [PATCH v3 1/4] Changes in Patchew cli to use rest-api 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: patchew-devel-bounces@redhat.com Errors-To: patchew-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.25 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Fri, 06 Jul 2018 09:42:52 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" - Disabled CSRF authentication until OAuth authentication, since DRF leads = to csrf error while handling sessionauthentication. - Added general rest_api function to make request to apis and get response. --- api/rest.py | 6 ++++++ patchew-cli | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/api/rest.py b/api/rest.py index 9ec0ae8..66644ba 100644 --- a/api/rest.py +++ b/api/rest.py @@ -25,7 +25,13 @@ from rest_framework.response import Response import rest_framework from mbox import addr_db_to_rest, MboxMessage from rest_framework.parsers import JSONParser, BaseParser +from rest_framework.authentication import SessionAuthentication =20 +class CsrfExemptSessionAuthentication(SessionAuthentication): + + def enforce_csrf(self, request): + return # To not perform the csrf check previously happening + =20 SEARCH_PARAM =3D 'q' =20 # patchew-specific permission classes diff --git a/patchew-cli b/patchew-cli index 174d1e6..e510e74 100755 --- a/patchew-cli +++ b/patchew-cli @@ -92,6 +92,40 @@ class SubCommand(object): r =3D None return r =20 + def rest_api_do(self, url_cmd, request_method=3D'get', content_type=3D= None, data=3DNone): + logging.debug("API call '%s':" % url_cmd) + logging.debug("data:\n%s" % data) + cookie =3D http.cookiejar.MozillaCookieJar(COOKIE_FILENAME) + try: + cookie.load() + except IOError: + pass + except http.cookiejar.LoadError: + print("Error while loading cookie", COOKIE_FILENAME) + pass + handler =3D urllib.request.HTTPCookieProcessor(cookie) + opener =3D urllib.request.build_opener(handler) + if url_cmd.startswith("http"): + url =3D url_cmd + else: + url =3D self.base_url + '/api/v1/' + url_cmd + '/' + if data is None: + post_data =3D "" + else: + post_data =3D data + req =3D urllib.request.Request(url, data=3Dbytes(post_data, encodi= ng=3D"utf-8"), method=3Drequest_method.upper()) + if content_type is not None: + req.add_header('Content-Type', content_type) + resp =3D opener.open(req) + cookie.save(ignore_discard=3DTrue, ignore_expires=3DTrue) + respdata =3D resp.read() + logging.debug("Server response:\n%s" % (respdata or "")) + if respdata: + r =3D json.loads(respdata.decode("utf-8")) + else: + r =3D None + return r + def do(self, args, argv): """Do command""" print("Not implemented") --=20 2.15.1 (Apple Git-101) _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel From nobody Thu Mar 28 20:26:41 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=patchew-devel-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=patchew-devel-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1530870179646355.52803916845244; Fri, 6 Jul 2018 02:42:59 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 050DA308A950; Fri, 6 Jul 2018 09:42:59 +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 EA31CC4AB2; Fri, 6 Jul 2018 09:42:58 +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 D59804BB78; Fri, 6 Jul 2018 09:42:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w669gwIJ012011 for ; Fri, 6 Jul 2018 05:42:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id 243A7C4ABE; Fri, 6 Jul 2018 09:42:58 +0000 (UTC) Received: from mx1.redhat.com (ext-mx09.extmail.prod.ext.phx2.redhat.com [10.5.110.38]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1CE1FC4AB2 for ; Fri, 6 Jul 2018 09:42:55 +0000 (UTC) Received: from mail-pf0-f196.google.com (mail-pf0-f196.google.com [209.85.192.196]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E2EFA4E918 for ; Fri, 6 Jul 2018 09:42:44 +0000 (UTC) Received: by mail-pf0-f196.google.com with SMTP id s21-v6so7999352pfm.6 for ; Fri, 06 Jul 2018 02:42:44 -0700 (PDT) Received: from localhost.localdomain ([182.74.40.122]) by smtp.gmail.com with ESMTPSA id r87-v6sm15257688pfb.1.2018.07.06.02.42.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 06 Jul 2018 02:42:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=rAHfLCpvGqL4zYjWK5jVRgQcn5p4rTTtT2ZX+B8Q+Tk=; b=vd+2OPItdCIKOIMZI//p1OtMu0hTC9h2dNDUAtdVSsRmkC5JK94l9beArBVdnIqxje IHF7x2s1h7Qx2hlimw8M2E/kJIgiSMP4bfTdJvKoKIzCRnX6UgUsS4z8GpzbmX3eG02R DCRVrGoTiQrBFnFdKffHU/49+z2jYT26WzGj4zDZTZOZCZNV2Qns9pymUM1RjPpx6OFm 9e6no/iD+jsbFfah5XQ4qNdxvDPioWualeVBmLlAK1UQLji+OYh3ZGMfmNB9PWwpw87d UIx6BBme1hpZ0plPRBAY7I8IWNEEwQpiOWiGm11zM4/5sIsQsxpitjOQwr4kDgAjgmaA Xi6Q== 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; bh=rAHfLCpvGqL4zYjWK5jVRgQcn5p4rTTtT2ZX+B8Q+Tk=; b=DxHsiYyFldngqR4PI6JcdHQWTSIjqZ+yOy91WqZ/0OnPkmJtZo4a5oUZdLitaCjVop KxaCvC30ikmnQJ8b0nfzccGapomiTTlU86fsxHg4tioai5krBkUksu0eAp0OLZNbic8s Eiij4SP1GfLwbX479VdL9LX+noG/eMKkd7Ba1z2ZhG3h7MWuzD7mpvSZbZ1frfx9mub0 0X6G39jjUCQVLfaK2vD7NlBCw4eJm+EELNZA0euqbZyyYUddNWP4vUnzZgfKQbHnjeg3 or6YT7h9T6nIgMxRXMTq8cvgLUM0sEq5YdikP/4AJttMNnW88WOsvzzGKby7P9O0+k8Q ZhYA== X-Gm-Message-State: APt69E32Hnt55VelzM6d4bn5ltH1YBeF2+juIhXoZXBMG6AmY41Sk1nR dg6jZLhMO1t85cJUfdK/06VaJQ== X-Google-Smtp-Source: AAOMgpc1JoT0aKnUFYqJWCJ9T2PkTzSaICuW1rUqVC5A++oEFT79uoJdIV6M3bZurHrybFXFDgaHkg== X-Received: by 2002:a63:6b86:: with SMTP id g128-v6mr8973998pgc.344.1530870163979; Fri, 06 Jul 2018 02:42:43 -0700 (PDT) From: Shubham Jain To: patchew-devel@redhat.com Date: Fri, 6 Jul 2018 15:09:45 +0530 Message-Id: <20180706093947.20025-3-shubhamjain7495@gmail.com> In-Reply-To: <20180706093947.20025-1-shubhamjain7495@gmail.com> References: <20180706093947.20025-1-shubhamjain7495@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 06 Jul 2018 09:42:45 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 06 Jul 2018 09:42:45 +0000 (UTC) for IP:'209.85.192.196' DOMAIN:'mail-pf0-f196.google.com' HELO:'mail-pf0-f196.google.com' FROM:'shubhamjain7495@gmail.com' RCPT:'' X-RedHat-Spam-Score: 1.55 * (DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, NML_ADSP_CUSTOM_MED, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_PASS, T_DKIM_INVALID) 209.85.192.196 mail-pf0-f196.google.com 209.85.192.196 mail-pf0-f196.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.38 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.27 X-loop: patchew-devel@redhat.com Cc: Shubham Jain Subject: [Patchew-devel] [PATCH v3 2/4] Make Patchew cli's Project use rest api 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: patchew-devel-bounces@redhat.com Errors-To: patchew-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Fri, 06 Jul 2018 09:42:59 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" -Make ProjectCommand use rest_api_do instead of api_do --- api/rest.py | 3 ++- patchew-cli | 34 +++++++++++++++++++--------------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/api/rest.py b/api/rest.py index 66644ba..39bdda0 100644 --- a/api/rest.py +++ b/api/rest.py @@ -31,7 +31,7 @@ class CsrfExemptSessionAuthentication(SessionAuthenticati= on): =20 def enforce_csrf(self, request): return # To not perform the csrf check previously happening - =20 + SEARCH_PARAM =3D 'q' =20 # patchew-specific permission classes @@ -146,6 +146,7 @@ class ProjectsViewSet(viewsets.ModelViewSet): queryset =3D Project.objects.all().order_by('id') serializer_class =3D ProjectSerializer permission_classes =3D (PatchewPermission,) + authentication_classes =3D (CsrfExemptSessionAuthentication, ) =20 @action(methods=3D['post'], detail=3DTrue, permission_classes=3D[Impor= tPermission]) def update_project_head(self, request, pk=3DNone): diff --git a/patchew-cli b/patchew-cli index e510e74..8425db2 100755 --- a/patchew-cli +++ b/patchew-cli @@ -255,11 +255,11 @@ class ProjectCommand(SubCommand): parser.add_argument("--verbose", "-v", action=3D"store_true", help=3D"Show details about projects") args =3D parser.parse_args(argv) - r =3D self.api_do("get-projects") + r =3D self.rest_api_do(url_cmd=3D"projects", request_method=3D'get= ') if args.raw: print(json.dumps(r, indent=3D2, separators=3D",:")) return 0 - for p in r: + for p in r['results']: print(p["name"]) if args.verbose: for k, v in p.items(): @@ -273,8 +273,8 @@ class ProjectCommand(SubCommand): parser.add_argument("name", nargs=3D"+", help=3D"The name of project to show info") args =3D parser.parse_args(argv) - r =3D self.api_do("get-projects") - for p in r: + r =3D self.rest_api_do(url_cmd=3D"projects", request_method=3D'get= ') + for p in r['results']: if not p["name"] in args.name: continue if len(args.name) > 1: @@ -297,12 +297,15 @@ class ProjectCommand(SubCommand): parser.add_argument("--desc", "-d", default=3D"", help=3D"Project short discription") args =3D parser.parse_args(argv) - self.api_do("add-project", - name=3Dargs.name, - mailing_list=3Dargs.mailing_list, - url=3Dargs.url, - git=3Dargs.git, - description=3Dargs.desc) + data =3D {'name':args.name, + 'mailing_list':args.mailing_list, + 'url':args.url, + 'git':args.git, + 'description':args.desc} + self.rest_api_do(url_cmd=3D"projects", + request_method=3D'post', + content_type=3D'application/json', + data=3Djson.dumps(data)) =20 def update_one_project(self, wd, project): logging.info("Updating project '%s'", project["name"]) @@ -354,16 +357,17 @@ class ProjectCommand(SubCommand): except Exception as e: logging.warn("Failed to push the new head to patchew mirro= r: %s", str(e)) - self.api_do("update-project-head", project=3Dproject["name"], - old_head=3Dold_head, - new_head=3Dnew_head, - message_ids=3Dmsgids) + url =3D project['resource_uri'] + "/update_project_head/" + self.rest_api_do(url, old_head=3Dold_head, + new_head=3Dnew_head, + message_ids=3Dmsgids) =20 def update_project(self, argv): parser =3D argparse.ArgumentParser() parser.add_argument("--name", "-n", help=3D"Name of the project") args =3D parser.parse_args(argv) - projects =3D self.api_do("get-projects", name=3Dargs.name) + projects =3D self.rest_api_do("projects") + projects =3D [p for p in projects['results'] if p['name'] =3D=3D a= rgs.name] wd =3D tempfile.mkdtemp() logging.debug("TMPDIR: %s", wd) try: --=20 2.15.1 (Apple Git-101) _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel From nobody Thu Mar 28 20:26:41 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=patchew-devel-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=patchew-devel-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1530870184903714.5889561351925; Fri, 6 Jul 2018 02:43:04 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5E9848764F; Fri, 6 Jul 2018 09:43:04 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4F43717008; Fri, 6 Jul 2018 09:43:04 +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 4330718037EC; Fri, 6 Jul 2018 09:43:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w669h34O012022 for ; Fri, 6 Jul 2018 05:43:03 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6869F3001933; Fri, 6 Jul 2018 09:43:03 +0000 (UTC) Received: from mx1.redhat.com (ext-mx12.extmail.prod.ext.phx2.redhat.com [10.5.110.41]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 60F03308332C for ; Fri, 6 Jul 2018 09:43:01 +0000 (UTC) Received: from mail-pf0-f179.google.com (mail-pf0-f179.google.com [209.85.192.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 60327308A943 for ; Fri, 6 Jul 2018 09:42:50 +0000 (UTC) Received: by mail-pf0-f179.google.com with SMTP id u16-v6so7983895pfh.3 for ; Fri, 06 Jul 2018 02:42:50 -0700 (PDT) Received: from localhost.localdomain ([182.74.40.122]) by smtp.gmail.com with ESMTPSA id r87-v6sm15257688pfb.1.2018.07.06.02.42.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 06 Jul 2018 02:42:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ZwSbGPVvtkgF9IsZvRpH78mntKxfsMe0LGPTy9lkFiU=; b=OxMPl1jM2DFcFb2pmWsO+Ut9orGq8/uXNpnsZV2VWkkevyMIvWMD5ys9osKURB4JSp QilMB3AkzYkIGNznoff+94x//d/Y0U0fiX51VcShQalK89kdQDsOV020U9mOkqnUI2GN 64wDvBpwDmUHeBFRn1znyoNR5RIgAZAAqm39J48A212z/Rjj0FhUJJPj9SdzI9w1DfCU X2dzupcMZIPv8EzINj719YQOvGcpCWhsQJ4nI5GnWjTG1cKjmlDg8p9jJxsnXuttZuqv z6tWLAQiUfmcgNp1YQu6bLnMHkKHUncUaQTfENKy5xjoymtcSjCYptDLGLbWb1H0eDew NaDQ== 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; bh=ZwSbGPVvtkgF9IsZvRpH78mntKxfsMe0LGPTy9lkFiU=; b=egld2OBGPEayTYttbwZ2FXrdD7oREKD/05ZBEMUzWWVqPuIXoOFvi8GXmNPUB2K7M3 dzZxEWfW28MHnCltxFkyFYN68xvRkV0ktltHcMP66dnGC0d8bYKgZzwfsuBO6XGaeBIZ ECLZmAtXrrpzm+gN838ps2sLEnIrU5zWAhTTSFdx16bkP2bEES1zM/eyosm+JvwDHaXK 0YnsiM9LmUq/ylI/0uovKul4f8VrBCCihzOBBwLhD1LvJpHnCK+CSbsS8UkI3oiMHbXP qaZR/ZlIph7lSGwad5kVVYO+j8cNkcdFhh4Rck1MLwiIgJ/Z4zkxiNqvLkutu4kcAQ4J Mq9Q== X-Gm-Message-State: APt69E0brXcuIHN1NtdB/FtyGa5M0cOi1/WJfILBlrCygYPCjma+y/Iw VMqV94ihoJtaGY2d6zBTqnBsXg== X-Google-Smtp-Source: AAOMgpdepXya5qYZEm4pRS9nLyotThe2KMTHA9Un74ZS1b0KnmNAXU82pgqRcj0FeTpk+H857G4Elg== X-Received: by 2002:a65:6252:: with SMTP id q18-v6mr8952934pgv.106.1530870169431; Fri, 06 Jul 2018 02:42:49 -0700 (PDT) From: Shubham Jain To: patchew-devel@redhat.com Date: Fri, 6 Jul 2018 15:09:46 +0530 Message-Id: <20180706093947.20025-4-shubhamjain7495@gmail.com> In-Reply-To: <20180706093947.20025-1-shubhamjain7495@gmail.com> References: <20180706093947.20025-1-shubhamjain7495@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Fri, 06 Jul 2018 09:42:50 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Fri, 06 Jul 2018 09:42:50 +0000 (UTC) for IP:'209.85.192.179' DOMAIN:'mail-pf0-f179.google.com' HELO:'mail-pf0-f179.google.com' FROM:'shubhamjain7495@gmail.com' RCPT:'' X-RedHat-Spam-Score: 1.551 * (DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, NML_ADSP_CUSTOM_MED, RCVD_IN_DNSWL_NONE, SPF_PASS, T_DKIM_INVALID) 209.85.192.179 mail-pf0-f179.google.com 209.85.192.179 mail-pf0-f179.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.41 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.26 X-loop: patchew-devel@redhat.com Cc: Shubham Jain Subject: [Patchew-devel] [PATCH v3 3/4] Make Delete Command use REST 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: patchew-devel-bounces@redhat.com Errors-To: patchew-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 06 Jul 2018 09:43:04 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Make patchew-cli's delete use REST api and added the missing test for delete --- api/rest.py | 2 ++ patchew-cli | 15 ++++++++++++++- tests/patchewtest.py | 3 +++ tests/test_message.py | 17 +++++++++++++++-- 4 files changed, 34 insertions(+), 3 deletions(-) diff --git a/api/rest.py b/api/rest.py index 39bdda0..9b47f37 100644 --- a/api/rest.py +++ b/api/rest.py @@ -320,6 +320,8 @@ class SeriesViewSet(BaseMessageViewSet): =20 class ProjectSeriesViewSet(ProjectMessagesViewSetMixin, SeriesViewSet, mixins.DestroyModelMixin): + authentication_classes =3D (CsrfExemptSessionAuthentication, ) + def collect_patches(self, series): if series.is_patch: patches =3D [series] diff --git a/patchew-cli b/patchew-cli index 8425db2..f90f3c5 100755 --- a/patchew-cli +++ b/patchew-cli @@ -181,7 +181,20 @@ class DeleteCommand(SubCommand): if not argv and not args.all: print("Must specify --all to delete all patches") return 1 - self.api_do("delete", terms=3Dargv) + series_list =3D [] + if args.all:=20 + resp =3D self.rest_api_do("projects") + for project in len(resp['result']): + url =3D project['series'] + series_resp =3D self.rest_api_do(url) + series_list =3D series_list + series_resp['results'] + else: + for term in argv: + series_resp =3D self.rest_api_do("series/?q%s"%term) + series_list =3D series_list + series_resp['results'] + for series in series_list: =20 + url =3D series['resource_uri'] + self.rest_api_do(url,request_method=3D'delete') return 0 =20 class ImportCommand(SubCommand): diff --git a/tests/patchewtest.py b/tests/patchewtest.py index 5bed3b9..847b3f9 100644 --- a/tests/patchewtest.py +++ b/tests/patchewtest.py @@ -100,6 +100,9 @@ class PatchewTestCase(django.test.LiveServerTestCase): def cli_import(self, mbox, rc=3D0): self.check_cli(["import", self.get_data_path(mbox)], rc) =20 + def cli_delete(self, terms, rc=3D0): + self.check_cli(["delete", terms], rc) + def get_data_path(self, fname): r =3D tempfile.NamedTemporaryFile(dir=3DRUN_DIR, prefix=3D"test-da= ta-", delete=3DFalse) d =3D os.path.join(BASE_DIR, "tests", "data", fname) diff --git a/tests/test_message.py b/tests/test_message.py index 9448aee..0b47b37 100755 --- a/tests/test_message.py +++ b/tests/test_message.py @@ -10,7 +10,8 @@ =20 import time import datetime -from tests.patchewtest import PatchewTestCase, main +import json +from patchewtest import PatchewTestCase, main =20 class ProjectTest(PatchewTestCase): =20 @@ -54,5 +55,17 @@ class ProjectTest(PatchewTestCase): asctime =3D message.get_asctime() self.assertEqual(asctime, "Sat Oct 22 9:06:04 2016") =20 + def test_delete(self): + self.cli_login() + self.add_project("QEMU", "qemu-devel@nongnu.org") + self.cli_import("0002-unusual-cased-tags.mbox.gz") + a, b =3D self.check_cli(["search", "-r", "-o", "subject,properties= "]) + ao =3D json.loads(a)[0] + self.assertEqual(["Fam Zheng", "famz@redhat.com"], + ao["properties"]["reviewers"][0]) + self.cli_delete("from:Fam") + a, b =3D self.check_cli(["search", "-r", "-o", "subject,properties= "]) + self.assertEqual("",a) + if __name__ =3D=3D '__main__': - main() + main() \ No newline at end of file --=20 2.15.1 (Apple Git-101) _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel From nobody Thu Mar 28 20:26:41 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=patchew-devel-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=patchew-devel-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1530870195126315.0241979266607; Fri, 6 Jul 2018 02:43:15 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9E863308330B; Fri, 6 Jul 2018 09:43:14 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8A818308BDA3; Fri, 6 Jul 2018 09:43:14 +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 7A93318037EC; Fri, 6 Jul 2018 09:43:14 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w669hCCG012033 for ; Fri, 6 Jul 2018 05:43:12 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9526B60921; Fri, 6 Jul 2018 09:43:12 +0000 (UTC) Received: from mx1.redhat.com (ext-mx03.extmail.prod.ext.phx2.redhat.com [10.5.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8ADD26090D for ; Fri, 6 Jul 2018 09:43:10 +0000 (UTC) Received: from mail-pf0-f194.google.com (mail-pf0-f194.google.com [209.85.192.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1B1E383F46 for ; Fri, 6 Jul 2018 09:42:59 +0000 (UTC) Received: by mail-pf0-f194.google.com with SMTP id j3-v6so7980844pfh.11 for ; Fri, 06 Jul 2018 02:42:59 -0700 (PDT) Received: from localhost.localdomain ([182.74.40.122]) by smtp.gmail.com with ESMTPSA id r87-v6sm15257688pfb.1.2018.07.06.02.42.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 06 Jul 2018 02:42:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=APB+ZC3iSR4438v8FU9hVWSSL9091leqCKxFA/UNElA=; b=pqn6adBgquU0MLET9222B1sAR+po2492R8qQ7Jo/jIbMhiMjqklkJS00pdMTjeDzqZ PJCyuUKVdwfAWHebNcnBKxLW1EjGeq7EVBRilNMG1kh8CgVTRWSL1r52AIwSoiQ0Vxc9 w9WN0Vk+oPaXrMG5tLnJLqorwcOXtj7sXdaXWs6xiHvw99nWZN+at1gYOGJ5fzP4Cj5n O31nl5N/IXLSc90TN9bUH5COJVWqPeIa4YvLauPVTYO5wBnALH8gWgB/EYy2z/pRVAuq Us4oKiUCFv2yR61lRZsJMJdcOji08bYQso9Xac2KWqNum76NIENKCtWzresUGxStPsXm TxAA== 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; bh=APB+ZC3iSR4438v8FU9hVWSSL9091leqCKxFA/UNElA=; b=oY9x2Y9AqU+qe+PfOcDJaBpriVDiX7T4MWUUb2IF+kbGXpLMpAUt/NdTo8nhFBRgya 5YsaU1DFJTX/MApXvpOYp8S0nYT0BJyTNmVqS1hQMMQyiVXHex5BsojxYClZ19NTw724 LmbWQrVnsbJsspu1+iM12NHmSCGN0ss/losQ/CrW2XAT/hgdQ5TU2DauIRbeTL5qY90C 05kL2tz93X6qzrg7qVlWwY1Z33eFhkiIPC4UMhOw6i0fzBQFOGnRKQNlM5MxGDBh4oOl 0MseFLah+f4AUDhdqrhuqzAnLYA02sRW9Qfoi2YlfziRvu4wGrgMkY7pMbWLkdM24orU bPxA== X-Gm-Message-State: APt69E1hUbfpzldWn31OazI16QXnDIKxrlv6cq3I3NL2MEu7n6OrQjf3 o27EgzHTBXvI3pP6R8jKlrMdeg== X-Google-Smtp-Source: AAOMgpesqpkqblBJT/XJnkzvc+nOVuJvo0R7J1P5+T13c/Wy+6Q1waowPV+SzSDsgWdP4EZwVi+A1g== X-Received: by 2002:a63:68c1:: with SMTP id d184-v6mr8748997pgc.239.1530870178110; Fri, 06 Jul 2018 02:42:58 -0700 (PDT) From: Shubham Jain To: patchew-devel@redhat.com Date: Fri, 6 Jul 2018 15:09:47 +0530 Message-Id: <20180706093947.20025-5-shubhamjain7495@gmail.com> In-Reply-To: <20180706093947.20025-1-shubhamjain7495@gmail.com> References: <20180706093947.20025-1-shubhamjain7495@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 06 Jul 2018 09:42:59 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 06 Jul 2018 09:42:59 +0000 (UTC) for IP:'209.85.192.194' DOMAIN:'mail-pf0-f194.google.com' HELO:'mail-pf0-f194.google.com' FROM:'shubhamjain7495@gmail.com' RCPT:'' X-RedHat-Spam-Score: 1.55 * (DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, NML_ADSP_CUSTOM_MED, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_PASS, T_DKIM_INVALID) 209.85.192.194 mail-pf0-f194.google.com 209.85.192.194 mail-pf0-f194.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.27 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: patchew-devel@redhat.com Cc: Shubham Jain Subject: [Patchew-devel] [PATCH v3 4/4] Make Import Command use Rest 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: patchew-devel-bounces@redhat.com Errors-To: patchew-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Fri, 06 Jul 2018 09:43:14 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Make patchew-cli's Import REST apis. Only authenticated users would be able= to import to recognized projects or the projects maintained by importer. I= f no projects are imported, exit status as 1 would be returned. Also change= d a test case in test_tags accordingly. --- api/models.py | 3 +++ api/rest.py | 3 ++- patchew-cli | 18 +++++++++++++----- tests/test_import.py | 8 ++++---- tests/test_tags.py | 5 ++--- 5 files changed, 24 insertions(+), 13 deletions(-) diff --git a/api/models.py b/api/models.py index ebaecde..6c21537 100644 --- a/api/models.py +++ b/api/models.py @@ -359,6 +359,9 @@ class MessageManager(models.Manager): def create(self, project, **validated_data): mbox =3D validated_data.pop('mbox') m =3D MboxMessage(mbox) + msg =3D Message.objects.filter(message_id=3Dm.get_message_id(), pr= oject=3Dproject).first() + if msg is not None: + return msg msg =3D Message(**validated_data) if 'in_reply_to' not in validated_data: msg.in_reply_to =3D m.get_in_reply_to() or "" diff --git a/api/rest.py b/api/rest.py index 9b47f37..876be75 100644 --- a/api/rest.py +++ b/api/rest.py @@ -423,7 +423,8 @@ class MessagesViewSet(BaseMessageViewSet): serializer_class =3D MessageSerializer permission_classes =3D (permissions.IsAuthenticatedOrReadOnly,) parser_classes =3D (JSONParser, MessagePlainTextParser, ) - =20 + authentication_classes =3D (CsrfExemptSessionAuthentication, ) + def create(self, request, *args, **kwargs): m =3D MboxMessage(request.data['mbox']) projects =3D [p for p in Project.objects.all() if p.recognizes(m)] diff --git a/patchew-cli b/patchew-cli index f90f3c5..08f85b4 100755 --- a/patchew-cli +++ b/patchew-cli @@ -220,11 +220,16 @@ class ImportCommand(SubCommand): print("[OLD] " + mo["Subject"]) return print("[NEW] " + mo["Subject"]) - r =3D self.api_do("import", mboxes=3D[mo.as_string()]) - for p in r: - if p not in projects: - projects.add(p) - print(p) + for mbox in [mo.as_string()]: + r =3D self.rest_api_do(url_cmd=3D"messages", + request_method=3D'post', + content_type=3D'message/rfc822', + data=3Dmbox) + projects_list =3D [x['resource_uri'].split("messages")[0] = for x in r['results']] + for p in projects_list: + if p not in projects: + projects.add(p) + print(p) if ff: open(ff, "wb").close() =20 @@ -250,6 +255,9 @@ class ImportCommand(SubCommand): for f in args.file: try: import_one(f) + if len(projects)=3D=3D0: + print("The message was not imported to any project. Pe= rhaps you're not logged in as an importer or maintainer") + r =3D1 except: print("Error in importing:", f) traceback.print_exc() diff --git a/tests/test_import.py b/tests/test_import.py index 5693d7e..07de3c6 100755 --- a/tests/test_import.py +++ b/tests/test_import.py @@ -107,21 +107,21 @@ class UnprivilegedImportTest(ImportTest): =20 test_import_belong_to_multiple_projects =3D None =20 - def check_import_should_fail(self): - self.cli_import("0001-simple-patch.mbox.gz", 1) + def check_import_status(self, exit_status): + self.cli_import("0001-simple-patch.mbox.gz", exit_status) a, b =3D self.check_cli(["search"]) self.assertNotIn('[Qemu-devel] [PATCH] quorum: Only compile when s= upported', a.splitlines()) =20 def test_anonymous_import(self): self.cli_logout() - self.check_import_should_fail() + self.check_import_status(exit_status=3D1) =20 def test_normal_user_import(self): self.cli_logout() self.create_user("someuser", "somepass") self.cli_login("someuser", "somepass") - self.check_import_should_fail() + self.check_import_status(exit_status=3D1) =20 def test_project_update(self): p =3D Project.objects.all()[0] diff --git a/tests/test_tags.py b/tests/test_tags.py index 6c162de..b4f21ac 100755 --- a/tests/test_tags.py +++ b/tests/test_tags.py @@ -22,9 +22,8 @@ class ImportTest(PatchewTestCase): self.p.save() =20 def test_import_one(self): - resp =3D self.apply_and_retrieve('0017-qemu-web-is-not-qemu.mbox.g= z', - self.p.id, '1504250391-6353-1-git-s= end-email-thuth@redhat.com') - self.assertEquals(resp.status_code, 404) + self.cli_import("0001-simple-patch.mbox.gz", rc=3D1) + # self.assertEquals(resp.status_code, 404) =20 def test_rest_single(self): resp =3D self.apply_and_retrieve('0003-single-patch-reviewed.mbox.= gz', --=20 2.15.1 (Apple Git-101) _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel