From nobody Sat Apr 20 04:08:23 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 152578028886276.24076585499392; Tue, 8 May 2018 04:51:28 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BFBFD30C809A; Tue, 8 May 2018 11:51:27 +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 A76345F72C; Tue, 8 May 2018 11:51:27 +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 95BD94CA96; Tue, 8 May 2018 11:51:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w48BpPwS011075 for ; Tue, 8 May 2018 07:51:26 -0400 Received: by smtp.corp.redhat.com (Postfix) id EF45130B4994; Tue, 8 May 2018 11:51:25 +0000 (UTC) Received: from mx1.redhat.com (ext-mx20.extmail.prod.ext.phx2.redhat.com [10.5.110.49]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E812730B4993 for ; Tue, 8 May 2018 11:51:23 +0000 (UTC) Received: from mail-pf0-f193.google.com (mail-pf0-f193.google.com [209.85.192.193]) (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 CF121300442E for ; Tue, 8 May 2018 11:51:12 +0000 (UTC) Received: by mail-pf0-f193.google.com with SMTP id x9so4695434pfm.2 for ; Tue, 08 May 2018 04:51:12 -0700 (PDT) Received: from localhost.localdomain ([112.196.135.149]) by smtp.gmail.com with ESMTPSA id r68sm60584105pfi.174.2018.05.08.04.51.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 May 2018 04:51:10 -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=2VDPuyZt+coQ9fLogwTciEX2t6tH3XHthFHiq/L6C9k=; b=eMeFKF3YvVGXgv36oasOtyqyC+S/vNw6uON/VKiydUc0RR0Ls4mU6plQp9ADxE7Oaj esGbtzMA2MVHXLad5lAGcWAR9y+/jM4ml3VmsmNct+48skfU4xhvBucQDJDlFKjaBlpI u7EW+rFra28kriD+NrxAp8UPPC9urD6jKhqJ6R6O/41rClPNHvM5jbk3asf9bJ43QMFe bQr5xIMlRPR23zZPus/azwwhQIiuHhNzg764lb5ifKQECCXojsATssPg/JhSUFdHQaDC BHeHA7zE+2KVROu6JYZ6H3w8WbfYJfLhqVVIGwmVWaFbECbPyl9wvT3GlMSfF7UL09Br OkVQ== 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=2VDPuyZt+coQ9fLogwTciEX2t6tH3XHthFHiq/L6C9k=; b=Vpv/Huq+CyuCniH3RiqR4u2sjdlPZ8i1US0AxQCKtTBJ2pLW9jJCw/dBMg/JjNeQIs TmeH/RE4ORo+c082orPW0zefpKWM3p3IiBRhQHmlMYeyeJhttxlJrEYB2fHMt47+HA5J xNS9UdBOH/H60rUSj57OjJK4tX8OZbBOgUix2nv8rYNQ8sp+Zg55+3IOS0CeBZL58DgC id2KaJ0sY/G/LClV+PFhpljxNwzYIo+Dp7rXv1EysNOrsSEKzMIVUpJ92vuzFMBhqtVP ndK8gqL1f9Cyv/yQL3ldun1ZRlG1Sk+xDZYSyerw8gjdpt40IWVWr4Ct/1u8gZvc1CeH bC/Q== X-Gm-Message-State: ALQs6tAE8LLLUENdv7OeJ5bnBgnBLfTUcP9hmGb1QVp7/HEJNvORgNEM HSYoFyLnE7gEmBbXrh22g227zA== X-Google-Smtp-Source: AB8JxZq67p68mkqKbt8Xf1SLngIClY+tCN8HGH+aOwW0f3k/R9omFvR9+ELuaY6RT0ghGXuTG+rb/A== X-Received: by 10.98.12.202 with SMTP id 71mr39577325pfm.61.1525780271829; Tue, 08 May 2018 04:51:11 -0700 (PDT) From: Shubham Jain To: patchew-devel@redhat.com Date: Tue, 8 May 2018 17:20:49 +0530 Message-Id: <20180508115051.60844-2-shubhamjain7495@gmail.com> In-Reply-To: <20180508115051.60844-1-shubhamjain7495@gmail.com> References: <20180508115051.60844-1-shubhamjain7495@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Tue, 08 May 2018 11:51:12 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Tue, 08 May 2018 11:51:12 +0000 (UTC) for IP:'209.85.192.193' DOMAIN:'mail-pf0-f193.google.com' HELO:'mail-pf0-f193.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.193 mail-pf0-f193.google.com 209.85.192.193 mail-pf0-f193.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.49 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.24 X-loop: patchew-devel@redhat.com Cc: Shubham Jain Subject: [Patchew-devel] [PATCH 1/3] Usage of getters and setters to get mbox field 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.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Tue, 08 May 2018 11:51:27 +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" Rename the existing "mbox" field to e.g. "mbox_blob" and add getters and se= tters for "mbox" # Please enter the commit message for your changes. Lines starting --- api/models.py | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/api/models.py b/api/models.py index 504f2c7..e161325 100644 --- a/api/models.py +++ b/api/models.py @@ -321,20 +321,26 @@ class Message(models.Model): =20 objects =3D MessageManager() =20 - def save_mbox(self, mbox): - save_blob(mbox, self.message_id) + def save_mbox(self, mbox_blob): + save_blob(mbox_blob, self.message_id) =20 def get_mbox_obj(self): self.get_mbox() return self._mbox_obj =20 def get_mbox(self): - if hasattr(self, "mbox"): - return self.mbox - self.mbox =3D load_blob(self.message_id) - self._mbox_obj =3D MboxMessage(self.mbox) - return self.mbox - + if hasattr(self, "mbox_blob"): + return self.mbox_blob + self.mbox_blob =3D load_blob(self.message_id) + self._mbox_obj =3D MboxMessage(self.mbox_blob) + return self.mbox_blob + =20 + mbox =3D property(get_mbox) + + @mbox.setter + def mbox(self, value): + self.mbox_blob =3D value + =20 def get_num(self): assert self.is_patch or self.is_series_head cur, total =3D 1, 1 --=20 2.14.3 (Apple Git-98) _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel From nobody Sat Apr 20 04:08:23 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 1525780295442888.638593044042; Tue, 8 May 2018 04:51:35 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 89F9630CB6EF; Tue, 8 May 2018 11:51:34 +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 74A4B65E91; Tue, 8 May 2018 11:51:34 +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 67F184CA96; Tue, 8 May 2018 11:51:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w48BpXk3011087 for ; Tue, 8 May 2018 07:51:33 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9700360C80; Tue, 8 May 2018 11:51:33 +0000 (UTC) Received: from mx1.redhat.com (ext-mx05.extmail.prod.ext.phx2.redhat.com [10.5.110.29]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8C9BD60C4E for ; Tue, 8 May 2018 11:51:29 +0000 (UTC) Received: from mail-pf0-f175.google.com (mail-pf0-f175.google.com [209.85.192.175]) (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 943F046267 for ; Tue, 8 May 2018 11:51:17 +0000 (UTC) Received: by mail-pf0-f175.google.com with SMTP id j20so9539998pff.10 for ; Tue, 08 May 2018 04:51:17 -0700 (PDT) Received: from localhost.localdomain ([112.196.135.149]) by smtp.gmail.com with ESMTPSA id r68sm60584105pfi.174.2018.05.08.04.51.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 May 2018 04:51:15 -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 :mime-version:content-transfer-encoding; bh=+0TzhxicBt2MdouwjfCiK2MsiWYgk95h3ylwM1vJkoo=; b=pI10LSHNv4LrWje2p24pl9xfE9rkLzb7qWpLdX9Ihi4cOGcPSPNNi3T8TuCtrMDVTo 77SWZ4/pFhos4lLiLHeURbtEH5UIuBByugiaEJYY4ptS8BNmVlVrkTBu2RxhtSwSDiXk d4vNR8vYMHnqBqfMzD6NeAIejxCX8gsk9BkDuShpiO2bR0TRwDSR2E+YYI8YpWYK3arm YaWBRNS/AMEAL5PZjL0p9QbMCJlJ8ZWCoqzct+xJ1e3A4M9lkfki+Qklhg5u7AJxelOX d/4tqYloTIOegWuTkVKokSqM/kfOH2lh/BSvaz+WoUgKe3htQKfVO3NS75MbHlNXGKue J6lA== 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:mime-version:content-transfer-encoding; bh=+0TzhxicBt2MdouwjfCiK2MsiWYgk95h3ylwM1vJkoo=; b=SVT/b55v7PSnxQ8pAAeAV3AA4prSL4+GQhdEfuRA74uej3V6t0tazYoKzV6gDYbzgt qaPo+iRVr5YKK5NL7Pcjxs63pXRZYwBq51862VckMSufSRa6NCMU7F9JV86lCVmcL3js AZHMkHr3yNm4wiJL6ss2vEtui2992EvgxYNTRvlDTXi/3zbApLnoLlE14bJkLJizGK+V urkf0hw+lTpTDvIoFLVxQyd46f7HcDZtSqXWo5BMt8PUMR/tROW4vSMRn8L7C68jBfeS 9lP7eAlAhPWoknHuyMxgB5hh7f6l100BHillgeH7JB/i7hVWg36taM5aGLh5ajC7OxbY 75xQ== X-Gm-Message-State: ALKqPwfQ4v3KMnx7r2e/GzBTB6pE4DRMH3klX39LvQY69d/kI5/UNbRI eMJ0PfVZOqnwgLg2+DmW+wOtcA== X-Google-Smtp-Source: AB8JxZoll8ETA+1IM/UbBG/SrGck0iB0pBBwoXyUiVuXrhx/l/oFORVLdHigmlUYuHYfOVd7RJGTPQ== X-Received: by 2002:a63:934f:: with SMTP id w15-v6mr1831249pgm.333.1525780276365; Tue, 08 May 2018 04:51:16 -0700 (PDT) From: Shubham Jain To: patchew-devel@redhat.com Date: Tue, 8 May 2018 17:20:50 +0530 Message-Id: <20180508115051.60844-3-shubhamjain7495@gmail.com> In-Reply-To: <20180508115051.60844-1-shubhamjain7495@gmail.com> References: <20180508115051.60844-1-shubhamjain7495@gmail.com> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 08 May 2018 11:51:17 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 08 May 2018 11:51:17 +0000 (UTC) for IP:'209.85.192.175' DOMAIN:'mail-pf0-f175.google.com' HELO:'mail-pf0-f175.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.175 mail-pf0-f175.google.com 209.85.192.175 mail-pf0-f175.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.29 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: patchew-devel@redhat.com Cc: Shubham Jain Subject: [Patchew-devel] [PATCH 2/3] rest: POST for message endpoint 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: patchew-devel-bounces@redhat.com Errors-To: patchew-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Tue, 08 May 2018 11:51:34 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 - Add "create" method to MessageManager so that it calls save_mbox() - Fix nested writable serializer issue - Add test for the create --- api/models.py | 19 +++++++ api/rest.py | 20 ++++--- tests/test_rest.py | 153 +++++++++++++++++++++++++++++++++++++++++++++++++= ++++ 3 files changed, 185 insertions(+), 7 deletions(-) diff --git a/api/models.py b/api/models.py index e161325..e043f09 100644 --- a/api/models.py +++ b/api/models.py @@ -247,6 +247,25 @@ class MessageManager(models.Manager): self.delete_subthread(r) msg.delete() =20 + def create(self, project, **validated_data): + mbox =3D validated_data.pop('mbox') + m =3D MboxMessage(mbox) + msg =3D Message(**validated_data) + if 'in_reply_to' not in validated_data: + msg.in_reply_to =3D m.get_in_reply_to() or "" + msg.stripped_subject =3D m.get_subject(strip_tags=3DTrue) + msg.version =3D m.get_version() + msg.prefixes =3D m.get_prefixes() + msg.is_series_head =3D m.is_series_head() + msg.is_patch =3D m.is_patch() + msg.patch_num =3D m.get_num()[0] + msg.project =3D project + msg.mbox =3D mbox + msg.save_mbox(mbox) + msg.save() + emit_event("MessageAdded", message=3Dmsg) + return msg + def add_message_from_mbox(self, mbox, user, project_name=3DNone): =20 def find_message_projects(m): diff --git a/api/rest.py b/api/rest.py index fc10b46..ed40a10 100644 --- a/api/rest.py +++ b/api/rest.py @@ -121,6 +121,7 @@ class HyperlinkedMessageField(HyperlinkedIdentityField): class AddressSerializer(serializers.Serializer): name =3D CharField(required=3DFalse) address =3D EmailField() + =20 def to_representation(self, obj): if obj[0] !=3D obj[1]: return {"name": obj[0], "address": obj[1]} @@ -140,9 +141,13 @@ class BaseMessageSerializer(serializers.ModelSerialize= r): fields =3D ('resource_uri', 'message_id', 'subject', 'date', 'send= er', 'recipients') =20 resource_uri =3D HyperlinkedMessageField(view_name=3D'messages-detail') - recipients =3D AddressSerializer(many=3DTrue) sender =3D AddressSerializer() + =20 + def create(self, validated_data): + validated_data['recipients'] =3D self.fields['recipients'].create(= validated_data['recipients']) + validated_data['sender'] =3D self.fields['sender'].create(validate= d_data['sender']) + return Message.objects.create(project=3Dself.context['project'], *= *validated_data) =20 # a message_id is *not* unique, so we can only list class BaseMessageViewSet(mixins.ListModelMixin, viewsets.GenericViewSet): @@ -157,6 +162,11 @@ class ProjectMessagesViewSetMixin(mixins.RetrieveModel= Mixin): def get_queryset(self): return self.queryset.filter(project=3Dself.kwargs['projects_pk']) =20 + def get_serializer_context(self): + try: + return {'project': Project.objects.get(id=3Dself.kwargs['proje= cts_pk']), 'request': self.request} + except:=20 + return Http404 # Series =20 class ReplySerializer(BaseMessageSerializer): @@ -287,10 +297,7 @@ class MessageSerializer(BaseMessageSerializer): class Meta: model =3D Message fields =3D BaseMessageSerializer.Meta.fields + ('mbox', ) - - def get_mbox(self, obj): - return obj.get_mbox() - mbox =3D SerializerMethodField() + mbox =3D CharField() =20 def get_fields(self): fields =3D super(MessageSerializer, self).get_fields() @@ -312,9 +319,8 @@ class StaticTextRenderer(renderers.BaseRenderer): return data =20 class MessagesViewSet(ProjectMessagesViewSetMixin, - BaseMessageViewSet): + BaseMessageViewSet, mixins.CreateModelMixin): serializer_class =3D MessageSerializer - @detail_route(renderer_classes=3D[StaticTextRenderer]) def mbox(self, request, *args, **kwargs): message =3D self.get_object() diff --git a/tests/test_rest.py b/tests/test_rest.py index 21bc2b9..a002865 100755 --- a/tests/test_rest.py +++ b/tests/test_rest.py @@ -18,6 +18,7 @@ from patchewtest import PatchewTestCase, main from api.models import Message from api.rest import AddressSerializer from collections import OrderedDict +import json =20 class RestTest(PatchewTestCase): def setUp(self): @@ -256,6 +257,158 @@ class RestTest(PatchewTestCase): self.assertEqual(resp_after.status_code, 404) self.assertEqual(resp_reply_after.status_code, 404) =20 + def test_create_message(self): + data =3D { + "message_id": "20171023201055.21973-11-andrew.smirnov@gmai= l.com", + "subject": "[Qemu-devel] [PATCH v2 10/27] imx_fec: Reserve= full 4K " + "page for the register file", + "date": "2017-10-23T20:10:38", + "sender": { + "name": "Andrey Smirnov", + "address": "andrew.smirnov@gmail.com" + }, + "recipients": [ + { + "address": "qemu-arm@nongnu.org" + }, + { + "name": "Peter Maydell", + "address": "peter.maydell@linaro.org" + }, + { + "name": "Andrey Smirnov", + "address": "andrew.smirnov@gmail.com" + }, + { + "name": "Jason Wang", + "address": "jasowang@redhat.com" + }, + { + "name": "Philippe Mathieu-Daud=C3=A9", + "address": "f4bug@amsat.org" + }, + { + "address": "qemu-devel@nongnu.org" + }, + { + "address": "yurovsky@gmail.com" + } + ], + "mbox": "From andrew.smirnov@gmail.com Mon Oct 23 20:10:38= 2017\nDelivered" + "-To: importer@patchew.org\nReceived-SPF: temperro= r (zoho.com: Err" + "or in retrieving data from DNS) client-ip=3D208.1= 18.235.17; envelop" + "e-from=3Dqemu-devel-bounces+importer=3Dpatchew.or= g@nongnu.org; helo=3Dl" + "ists.gnu.org;\nAuthentication-Results: mx.zohomai= l.com;\n\tdkim=3Df" + "ail;\n\tspf=3Dtemperror (zoho.com: Error in retri= eving data from DN" + "S) smtp.mailfrom=3Dqemu-devel-bounces+importer= =3Dpatchew.org@nongnu." + "org\nReturn-Path: \nReceived: from lists.gnu.org (208.118.235.= 17 [208.118.235." + "17]) by mx.zohomail.com\n\twith SMTPS id 15087900= 23478635.2925706" + "919272; Mon, 23 Oct 2017 13:20:23 -0700 (PDT)\nRe= ceived: from loc" + "alhost ([::1]:40414 helo=3Dlists.gnu.org)\n\tby l= ists.gnu.org with " + "esmtp (Exim 4.71)\n\t(envelope-from )\n\tid 1e6jCo-0007Cr-Ed\n= \tfor importer@p" + "atchew.org; Mon, 23 Oct 2017 16:20:14 -0400\nRece= ived: from eggs." + "gnu.org ([2001:4830:134:3::10]:46254)\n\tby lists= .gnu.org with es" + "mtp (Exim 4.71)\n\t(envelope-from ) id " + "1e6j4M-0000Ia-AF\n\tfor qemu-devel@nongnu.org; Mo= n, 23 Oct 2017 1" + "6:11:32 -0400\nReceived: from Debian-exim by eggs= .gnu.org with sp" + "am-scanned (Exim 4.71)\n\t(envelope-from ) id 1e6j4L-0002WU-ES\n\tfor qemu-devel@nongnu.= org; Mon, 23 Oct" + " 2017 16:11:30 -0400\nReceived: from mail-pf0-x24= 1.google.com ([2" + "607:f8b0:400e:c00::241]:47361)\n\tby eggs.gnu.org= with esmtps (TL" + "S1.0:RSA_AES_128_CBC_SHA1:16)\n\t(Exim 4.71) (env= elope-from )\n\tid 1e6j4J-0002VQ-5h; Mo= n, 23 Oct 2017 1" + "6:11:27 -0400\nReceived: by mail-pf0-x241.google.= com with SMTP id" + " z11so17896780pfk.4;\n\tMon, 23 Oct 2017 13:11:27= -0700 (PDT)\nRe" + "ceived: from squirtle.westlake.spaceflightindustr= ies.com ([173.22" + "6.206.194])\n\tby smtp.gmail.com with ESMTPSA id\= n\tj1sm15181623p" + "fj.108.2017.10.23.13.11.24\n\t(version=3DTLS1_2 c= ipher=3DECDHE-RSA-CH" + "ACHA20-POLY1305 bits=3D256/256);\n\tMon, 23 Oct 2= 017 13:11:25 -0700" + " (PDT)\nDKIM-Signature: v=3D1; a=3Drsa-sha256; c= =3Drelaxed/relaxed; d=3Dg" + "mail.com; s=3D20161025;\n\th=3Dfrom:to:cc:subject= :date:message-id:in-" + "reply-to:references\n\t:mime-version:content-tran= sfer-encoding;\n" + "\tbh=3DzmFol33kPLVHCkj7Ro+lVg1LTAQod/G9dNqJXtckib= I=3D;\n\tb=3DD49+KCtse" + "bdshdA2kxqNqCWLEOTSRXI61CbfBrS3YYbGspt/3vTIRCLSKN= hICr2UOc\n\t7BhL" + "XRtMKhn2gomHPqqSHOSp+hB5XtMmBNpBpkQyXMHoGkgmjg0II= F02Vzn4i2QzP8C9" + "\n\t0SDZb6VYnz70J5HY0KZwVfQ+Rc5qgJEfcTHzuzZ4qHcbX= xPHYCGYo1yDG6bEU" + "LNp2sRB\n\tGekoCKine5V1Uc+8aKmIeQA3zTXj2BLYqIQFi3= UdiEemj94Gs3UFkE" + "kV3kTtCBwBVYep\n\tCvtbjBMI4Kb2Rcyb7taNS1PwjoXo4nz= yPqSftf5CtxE3FYQ" + "6pSHkU8H1cqi4os4RgACQ\n\t6rrA=3D=3D\nX-Google-DKI= M-Signature: v=3D1; a=3D" + "rsa-sha256; c=3Drelaxed/relaxed;\n\td=3D1e100.net= ; s=3D20161025;\n\th=3Dx" + "-gm-message-state:from:to:cc:subject:date:message= -id:in-reply-to" + "\n\t:references:mime-version:content-transfer-enc= oding;\n\tbh=3DzmF" + "ol33kPLVHCkj7Ro+lVg1LTAQod/G9dNqJXtckibI=3D;\n\tb= =3DkG94Z4+JpBMpVNtWI" + "ASASHAaqcxeUgqF149vlfmPjsUsUZoE69zK/Xq8lz25p+TskP= \n\tu+sFtsuT//gI" + "M/gFEeFYPBUEECFh+cSu6vYqjvy7W+o1dt0CkQS0K4sG2a6PD= eXTc7Dw\n\tYOmEE" + "gzEW+JtEp27yE8L5Yiur7k9cMnq6AGsLtrNa4leHN8KfnBLpZ= DJ1w2BTVAST/Mt\n" + "\tp5OmcBALM2s2PfVxV2AqFIC03+BUkFo78Yl0dJkT95uUWQv= XOrYnhrJGikBOpxf" + "e2GEl\n\tdX/N0knNvw1ILQigiiD7mTg2pWBXXdi9ncxWFbWG= av3NFgMuMj9Le7dh" + "Merg+f0Pqzqq\n\tuMRw=3D=3D\nX-Gm-Message-State: A= MCzsaVtdnaUNbjj5huOS" + "I8ibhSVAiVnF57PiIS4oVle1IVoBcH6i/W4\n\tsAtvFi/nF5= bYIYfQxgZMU93rvm" + "Mn\nX-Google-Smtp-Source: ABhQp+Tw1GtSPaSw51tZkI3= AfiuyluStPI8C5/3" + "esBqFkirOMfsjtlRNoBcr8lgEf/55RwhQLiI5mQ=3D=3D\nX-= Received: by 10.98.6" + "5.218 with SMTP id g87mr14269292pfd.105.150878948= 6104;\n\tMon, 23" + " Oct 2017 13:11:26 -0700 (PDT)\nFrom: Andrey Smir= nov \nTo: qemu-arm@nongnu.org\nDate: Mo= n, 23 Oct 2017 1" + "3:10:38 -0700\nMessage-Id: <20171023201055.21973-= 11-andrew.smirno" + "v@gmail.com>\nX-Mailer: git-send-email 2.13.5\nIn= -Reply-To: <2017" + "1023201055.21973-1-andrew.smirnov@gmail.com>\nRef= erences: <201710" + "23201055.21973-1-andrew.smirnov@gmail.com>\nMIME-= Version: 1.0\nCo" + "ntent-Type: text/plain; charset=3D\"utf-8\"\nCont= ent-Transfer-Encod" + "ing: base64\nX-detected-operating-system: by eggs= .gnu.org: Genre " + "and OS details not\n\trecognized.\nX-Received-Fro= m: 2607:f8b0:400" + "e:c00::241\nSubject: [Qemu-devel] [PATCH v2 10/27= ] imx_fec: Reser" + "ve full 4K page for the\n register file\nX-BeenTh= ere: qemu-devel@" + "nongnu.org\nX-Mailman-Version: 2.1.21\nPrecedence= : list\nList-Id:" + " \nList-Unsubscribe: ,\n\t\nList-Archive: <= http://lists.nongn" + "u.org/archive/html/qemu-devel/>\nList-Post: \nList-Help: \nList-Subscribe: ,\n\t\nCc: Peter Maydell ,\n\tAnd" + "rey Smirnov ,\n\tJason = Wang ,\n\t=3D?UTF-8?q?Philippe=3D20Mathieu-D= aud=3DC3=3DA9?=3D ,\n\tqemu-devel@nongnu.org, yurovsky@gma= il.com\nErrors-T" + "o: qemu-devel-bounces+importer=3Dpatchew.org@nong= nu.org\nSender: \"" + "Qemu-devel\" " + "\nX-ZohoMail-DKIM: fail (Header signature does no= t verify)\nX-Zoh" + "oMail: RDKM_2 RSF_6 Z_629925259 SPT_0\n\nU29tZS= BpLk1YIFNvQ3MgKG" + "UuZy4gaS5NWDcpIGhhdmUgRkVDIHJlZ2lzdGVycyBnb2luZyB= hcyBm\nYXIgYXMgb" + "2Zmc2V0CjB4NjE0LCBzbyB0byBhdm9pZCBnZXR0aW5nIGFib3= J0cyB3aGVuIGFjY2" + "Vz\nc2luZyB0aG9zZSBvbiBRRU1VLCBleHRlbmQKdGhlIHJlZ= 2lzdGVyIGZpbGUgd" + "G8gY292ZXIgNEtC\nIG9mIGFkZHJlc3Mgc3BhY2UgaW5zdGVh= ZCBvZiBqdXN0IDFL" + "LgoKQ2M6IFBldGVyIE1heWRlbGwg\nPHBldGVyLm1heWRlbGx= AbGluYXJvLm9yZz4" + "KQ2M6IEphc29uIFdhbmcgPGphc293YW5nQHJlZGhh\ndC5jb2= 0+CkNjOiBQaGlsaX" + "BwZSBNYXRoaWV1LURhdWTDqSA8ZjRidWdAYW1zYXQub3JnPgp= DYzog\ncWVtdS1kZ" + "XZlbEBub25nbnUub3JnCkNjOiBxZW11LWFybUBub25nbnUub3= JnCkNjOiB5dXJvdn" + "Nr\neUBnbWFpbC5jb20KU2lnbmVkLW9mZi1ieTogQW5kcmV5I= FNtaXJub3YgPGFuZ" + "HJldy5zbWlybm92\nQGdtYWlsLmNvbT4KLS0tCiBody9uZXQv= aW14X2ZlYy5jIHwg" + "MiArLQogMSBmaWxlIGNoYW5nZWQs\nIDEgaW5zZXJ0aW9uKCs= pLCAxIGRlbGV0aW9" + "uKC0pCgpkaWZmIC0tZ2l0IGEvaHcvbmV0L2lteF9m\nZWMuYy= BiL2h3L25ldC9pbX" + "hfZmVjLmMKaW5kZXggNDhkMDEyY2FkNi4uZTIzNmJjOTMzYyA= xMDA2\nNDQKLS0tI" + "GEvaHcvbmV0L2lteF9mZWMuYworKysgYi9ody9uZXQvaW14X2= ZlYy5jCkBAIC0xMj" + "Uy\nLDcgKzEyNTIsNyBAQCBzdGF0aWMgdm9pZCBpbXhfZXRoX= 3JlYWxpemUoRGV2a" + "WNlU3RhdGUgKmRl\ndiwgRXJyb3IgKiplcnJwKQogICAgIFN5= c0J1c0RldmljZSAq" + "c2JkID0gU1lTX0JVU19ERVZJQ0Uo\nZGV2KTsKIAogICAgIG1= lbW9yeV9yZWdpb25" + "faW5pdF9pbygmcy0+aW9tZW0sIE9CSkVDVChkZXYp\nLCAmaW= 14X2V0aF9vcHMsIH" + "MsCi0gICAgICAgICAgICAgICAgICAgICAgICAgIFRZUEVfSU1= YX0ZF\nQywgMHg0M" + "DApOworICAgICAgICAgICAgICAgICAgICAgICAgICBUWVBFX0= lNWF9GRUMsIDB4MT" + "Aw\nMCk7CiAgICAgc3lzYnVzX2luaXRfbW1pbyhzYmQsICZzL= T5pb21lbSk7CiAgI" + "CAgc3lzYnVzX2lu\naXRfaXJxKHNiZCwgJnMtPmlycVswXSk7= CiAgICAgc3lzYnVz" + "X2luaXRfaXJxKHNiZCwgJnMtPmly\ncVsxXSk7Ci0tIAoyLjE= zLjUKCgo=3D\n\n" + } + =20 + resp =3D self.api_client.post(self.PROJECT_BASE + "messages/", jso= n.dumps(data), content_type=3D'application/json') + self.assertEqual(resp.status_code, 201) + resp_get =3D self.api_client.get(self.PROJECT_BASE + "messages/201= 71023201055.21973-11-andrew.smirnov@gmail.com/") + self.assertEqual(resp_get.status_code, 200) + self.assertEqual(resp.data['subject'], "[Qemu-devel] [PATCH v2 10/= 27] imx_fec: Reserve full 4K " + "page for the register file") + + def test_message(self): series =3D self.apply_and_retrieve('0001-simple-patch.mbox.gz', self.p.id, '20160628014747.20971-= 1-famz@redhat.com') --=20 2.14.3 (Apple Git-98) _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel From nobody Sat Apr 20 04:08:23 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 1525780298253749.6641127740825; Tue, 8 May 2018 04:51:38 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 607C830001DA; Tue, 8 May 2018 11:51:37 +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 50E90100195A; Tue, 8 May 2018 11:51:37 +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 43FE84CA96; Tue, 8 May 2018 11:51:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w48Bpam0011097 for ; Tue, 8 May 2018 07:51:36 -0400 Received: by smtp.corp.redhat.com (Postfix) id BE01D100195F; Tue, 8 May 2018 11:51:36 +0000 (UTC) Received: from mx1.redhat.com (ext-mx10.extmail.prod.ext.phx2.redhat.com [10.5.110.39]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B6FC7100195A for ; Tue, 8 May 2018 11:51:35 +0000 (UTC) Received: from mail-pl0-f67.google.com (mail-pl0-f67.google.com [209.85.160.67]) (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 21D645D5E9 for ; Tue, 8 May 2018 11:51:23 +0000 (UTC) Received: by mail-pl0-f67.google.com with SMTP id f7-v6so2093956plr.4 for ; Tue, 08 May 2018 04:51:23 -0700 (PDT) Received: from localhost.localdomain ([112.196.135.149]) by smtp.gmail.com with ESMTPSA id r68sm60584105pfi.174.2018.05.08.04.51.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 May 2018 04:51:21 -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=QgAN90RN9jmPuVI+dZObV96N1e0SvhGV7HQCOYoWQyA=; b=cucM7DSOZr6cDdI9khMD3pTC+pT7hNKly/+AVlYO7bknCAz3T7JRPCtUVDY6aTqR35 xD1rReBrSLb+zilsEjuruMRZB8ppMkhDPSxt4KztHAd3SuD9A44Ak3X70ZbSO8+i9ppS gQQEssgQGOu1L8cP2CJHCulZ6OyBkoR6QfVRStQ+3kGDPDQ/BY7pkOp9+urz8TMPwBYm dfKm5SG2SbLe/JerlTvY8XY4Uuj9iH76VBqrBYfXHdFSqrZKhW5/8m6S6t2Lm/i1v/8K DGQplH/P0HLp/I7lUxCMU+ndChMxAKH414MOa42e0HlxGFuJ3cOaCYfETdoZ8t2s3vKH 8PXw== 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=QgAN90RN9jmPuVI+dZObV96N1e0SvhGV7HQCOYoWQyA=; b=ghNboOCqpFIw5EN4AbW6wFGKV+C/uv0jnrBR+byPTpJfuW38tfwiFdSQCnUWoFjFFA eC4Zu8LdEB3YfXnnRxC+m2bZs9XAceJcXiTLIhMVgxqPQUf29H+vWLh9s4lEbhNx62l9 2CGhQDNcEHvbCZCjoaDLcdhBZYK5I7EMEtEZE/9t5mTyQp1es0cNCz/nVfqOasO59rWr p1gt+bxpbY5GaIpYp8drX5oVaqC7Vb8QDYk9Rn4ov3V192ff0Roohw+4sutI2gU2UCMd vnuos8+DjJzCrkcWItLbD6bWS6Ay6Rhen9jHAB1bPILyQ9S5tzSk2jniHpXgCGDuLjCF 7xBA== X-Gm-Message-State: ALQs6tC+jbMj1s8R3SJShGlxH2/ix/SezPeyeP5N5pO9OX84MPXw6/Un /BiNJEHv5Z+6A1x+8NoNkQeSBg== X-Google-Smtp-Source: AB8JxZpE9X7vXeY7xutHwaro5NPiBnhWYipVC0Ph0K9KSJh+2nSU0IwF0+e6YM6wRr/sHMl/0eihLw== X-Received: by 2002:a17:902:8:: with SMTP id 8-v6mr40511403pla.287.1525780282025; Tue, 08 May 2018 04:51:22 -0700 (PDT) From: Shubham Jain To: patchew-devel@redhat.com Date: Tue, 8 May 2018 17:20:51 +0530 Message-Id: <20180508115051.60844-4-shubhamjain7495@gmail.com> In-Reply-To: <20180508115051.60844-1-shubhamjain7495@gmail.com> References: <20180508115051.60844-1-shubhamjain7495@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 08 May 2018 11:51:23 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 08 May 2018 11:51:23 +0000 (UTC) for IP:'209.85.160.67' DOMAIN:'mail-pl0-f67.google.com' HELO:'mail-pl0-f67.google.com' FROM:'shubhamjain7495@gmail.com' RCPT:'' X-RedHat-Spam-Score: 1.531 * (DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, NML_ADSP_CUSTOM_MED, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS, T_DKIM_INVALID) 209.85.160.67 mail-pl0-f67.google.com 209.85.160.67 mail-pl0-f67.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.39 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: patchew-devel@redhat.com Cc: Shubham Jain Subject: [Patchew-devel] [PATCH 3/3] Text to json converter for mbox 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.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Tue, 08 May 2018 11:51:37 +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" - Mbox would now return a dictionary object which would help REST API deser= ialize easily into model object. - Added test for text to json converter. For recepients and sender couldn't use AddressSerializer as api.rest calls = models which call back mbox. Possible soulution to replace to_representatio= n in AddressSerializer with add_tuple_to_dic to remove code redundancy? --- mbox.py | 18 ++++++++++ tests/test_mbox.py | 102 +++++++++++++++++++++++++++++++++++++++++++++++++= ++++ 2 files changed, 120 insertions(+) diff --git a/mbox.py b/mbox.py index fe108f3..1296078 100644 --- a/mbox.py +++ b/mbox.py @@ -13,6 +13,7 @@ import email.utils import email.header import datetime import re +from rest_framework.fields import DateTimeField =20 def _parse_header(header): r =3D '' @@ -34,6 +35,11 @@ def _addr_fmt_text(name, addr): else: return addr =20 +def addr_tuple_to_dic(obj): + if obj[0] !=3D obj[1]: + return {"name": obj[0], "address": obj[1]} + else: + return {"address": obj[1]} =20 class MboxMessage(object): """ Helper class to process mbox """ @@ -269,3 +275,15 @@ class MboxMessage(object): if c =3D=3D 0: return True return False + + def get_json(self): + """Return the JSON format of the mbox """ + msg =3D {} + msg['message_id'] =3D self.get_message_id() + msg['in_reply_to'] =3D self.get_in_reply_to() or "" + msg['date'] =3D DateTimeField().to_representation(self.get_date()) + msg['subject'] =3D self.get_subject() + msg['sender'] =3D addr_tuple_to_dic(self.get_from()) + msg['recipients'] =3D [addr_tuple_to_dic(x) for x in (self.get_to(= ) + self.get_cc())] + msg['mbox'] =3D self.get_mbox() + return msg \ No newline at end of file diff --git a/tests/test_mbox.py b/tests/test_mbox.py index 8493df7..7a21d4a 100755 --- a/tests/test_mbox.py +++ b/tests/test_mbox.py @@ -52,5 +52,107 @@ Virtualization: qemu.org | libvirt.org msg =3D mbox.MboxMessage(f.read()) self.assertTrue(msg.is_patch()) =20 + def test_get_json(self): + expected =3D {'message_id': '20160628014747.20971-1-famz@redhat.co= m', + 'in_reply_to': '', + 'date': '2016-06-28T01:47:47', + 'subject': '[Qemu-devel] [PATCH] quorum: Only compile = when supported', + 'sender': {'name': 'Fam Zheng', 'address': 'famz@redha= t.com'}, + 'recipients': [{'address': 'qemu-devel@nongnu.org'}, + {'name': 'Kevin Wolf', 'address': 'kwol= f@redhat.com'}, + {'name': 'Alberto Garcia', 'address': '= berto@igalia.com'}, + {'address': 'qemu-block@nongnu.org'}, + {'name': 'Max Reitz', 'address': 'mreit= z@redhat.com'}], + 'mbox': 'Delivered-To: importer@patchew.org\nReceived-= SPF: ' + 'Pass (zoho.com: domain of qemu-devel-bounces@= nongnu.org ' + 'designates 208.118.235.17 as permitted sender= ) client-ip: ' + '208.118.235.17\nReceived-SPF: pass (zoho.com:= domain of ' + 'gnu.org designates 208.118.235.17 as permitte= d sender) ' + 'client-ip=3D208.118.235.17; envelope-from=3Dq= emu-devel-bounces+' + 'importer=3Dpatchew.org@nongnu.org; helo=3Dlis= ts.gnu.org;\n' + 'Return-Path: ' + '\nReceived: from lists.gnu.org (lists.gnu.org= [208.118.235.17]) ' + 'by mx.zohomail.com\n\twith SMTPS id 146707897= 1424862.8927889595075;' + ' Mon, 27 Jun 2016 18:56:11 -0700 (PDT)\nRecei= ved: from localhost ' + '([::1]:33689 helo=3Dlists.gnu.org)\n\tby list= s.gnu.org with esmtp ' + '(Exim 4.71)\n\t(envelope-from )\n\tid 1bHi94-0006LP-= Ok\n\tfor ' + 'importer@patchew.org; Mon, 27 Jun 2016 21:48:= 58 -0400\nReceived: ' + 'from eggs.gnu.org ([2001:4830:134:3::10]:5327= 0)\n\tby lists.gnu.org' + ' with esmtp (Exim 4.71)\n\t(envelope-from ) id ' + '1bHi8E-0002Lm-KR\n\tfor qemu-devel@nongnu.org= ; Mon, 27 Jun 2016 ' + '21:48:07 -0400\nReceived: from Debian-exim by= eggs.gnu.org with ' + 'spam-scanned (Exim 4.71)\n\t(envelope-from ) ' + 'id 1bHi8D-0008T4-N7\n\tfor qemu-devel@nongnu.= org; Mon, 27 Jun ' + '2016 21:48:06 -0400\nReceived: from mx1.redha= t.com ' + '([209.132.183.28]:47972)\n\tby eggs.gnu.org w= ith esmtp ' + '(Exim 4.71)\n\t(envelope-from )\n\tid ' + '1bHi86-0008SN-IZ; Mon, 27 Jun 2016 21:47:58 -= 0400\nReceived: ' + 'from int-mx10.intmail.prod.int.phx2.redhat.co= m\n\t' + '(int-mx10.intmail.prod.int.phx2.redhat.com [1= 0.5.11.23])\n\t' + '(using TLSv1.2 with cipher ECDHE-RSA-AES256-G= CM-SHA384 ' + '(256/256 bits))\n\t(No client certificate req= uested)\n\tby ' + 'mx1.redhat.com (Postfix) with ESMTPS id BDB00= 7F088;\n\tTue, ' + '28 Jun 2016 01:47:57 +0000 (UTC)\nReceived: ' + 'from ad.usersys.redhat.com (dhcp-15-133.nay.r= edhat.com\n\t' + '[10.66.15.133])\n\tby int-mx10.intmail.prod.i= nt.phx2.redhat.com' + ' (8.14.4/8.14.4) with ESMTP\n\tid u5S1lssT024= 908; Mon, 27 Jun ' + '2016 21:47:55 -0400\nFrom: Fam Zheng \nTo: ' + 'qemu-devel@nongnu.org\nDate: Tue, 28 Jun 2016= 09:47:47 ' + '+0800\nMessage-Id: <20160628014747.20971-1-fa= mz@redhat.com>\n' + 'X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23\n= X-Greylist: ' + 'Sender IP whitelisted, not delayed by milter-= greylist-4.5.16\n\t' + '(mx1.redhat.com [10.5.110.26]);\n\tTue, 28 Ju= n 2016 01:47:57 ' + '+0000 (UTC)\nX-detected-operating-system: by = eggs.gnu.org: ' + 'GNU/Linux 2.2.x-3.x [generic]\nX-Received-Fro= m: 209.132.183.28\n' + 'Subject: [Qemu-devel] [PATCH] quorum: Only co= mpile when supported\n' + 'X-BeenThere: qemu-devel@nongnu.org\nX-Mailman= -Version: 2.1.21\n' + 'Precedence: list\nList-Id: \nList-Unsubscribe:' + ' ,\n\t' + '\n' + 'List-Archive: \n' + 'List-Post: \nLi= st-Help: ' + '\nList-Subscribe:' + ' ,\n\t' + '\nCc:' + ' Kevin Wolf , Alberto Garci= a ,' + '\n\tqemu-block@nongnu.org, Max Reitz \nErrors-To:' + ' qemu-devel-bounces+importer=3Dpatchew.org@no= ngnu.org\nSender: ' + '"Qemu-devel" \n' + 'X-ZohoMail-Owner: <20160628014747.20971-1-fam= z@redhat.com>+zmo_0_' + '\n' + 'X-ZohoMail-Sender: 209.132.183.28\nX-ZohoMail= : RSF_0 Z_629925259 ' + 'SPT_1 Z_629926901 SPT_1 SS_1 SFPD SFPP UW246= 8 UB2468 ZFF-EB_1' + ' COSF ODL SGR3_1_2_0_27046_53\nX-Zoho-Viru= s-Status: 2\n\n' + 'This was the only exceptional module init fun= ction that does ' + 'something\nelse than a simple list of bdrv_re= gister() calls, ' + 'in all the block\ndrivers.\n\nThe qcrypto_has= h_supports is actually' + ' a static check, determined at\ncompile time.= Follow the ' + 'block-job-$(CONFIG_FOO) convention for\nconsi= stency.\n\n' + 'Signed-off-by: Fam Zheng \n-= --\n block/' + 'Makefile.objs | 2 +-\n block/quorum.c | = 4 ----\n 2 files' + ' changed, 1 insertion(+), 5 deletions(-)\n\nd= iff --git a/block/' + 'Makefile.objs b/block/Makefile.objs\nindex 44= a5416..c87d605 ' + '100644\n--- a/block/Makefile.objs\n+++ b/bloc= k/Makefile.objs\n@@' + ' -3,7 +3,7 @@ block-obj-y +=3D qcow2.o qcow2-= refcount.o qcow2-cluster.o' + ' qcow2-snapshot.o qcow2-c\n block-obj-y +=3D = qed.o qed-gencb.o ' + 'qed-l2-cache.o qed-table.o qed-cluster.o\n bl= ock-obj-y +=3D ' + 'qed-check.o\n block-obj-$(CONFIG_VHDX) +=3D v= hdx.o vhdx-endian.o' + ' vhdx-log.o\n-block-obj-y +=3D quorum.o\n+blo= ck-obj-$(CONFIG_GNUTLS_HASH)' + ' +=3D quorum.o\n block-obj-y +=3D parallels.o= blkdebug.o blkverify.o ' + 'blkreplay.o\n block-obj-y +=3D block-backend.= o snapshot.o qapi.o\n ' + 'block-obj-$(CONFIG_WIN32) +=3D raw-win32.o wi= n32-aio.o\ndiff --git ' + 'a/block/quorum.c b/block/quorum.c\nindex 331b= 726..18fbed8 100644\n' + '--- a/block/quorum.c\n+++ b/block/quorum.c\n@= @ -1113,10 +1113,6 @@' + ' static BlockDriver bdrv_quorum =3D {\n \n st= atic void bdrv_quorum_init' + '(void)\n {\n- if (!qcrypto_hash_supports(Q= CRYPTO_HASH_ALG_SHA256))' + ' {\n- /* SHA256 hash support is requir= ed for quorum device */\n-' + ' return;\n- }\n bdrv_register(&= bdrv_quorum);\n }\n \n-- \n' + '2.9.0\n\n\n'} + dp =3D self.get_data_path("0001-simple-patch.mbox.gz") + with open(dp, "r") as f: + msg =3D mbox.MboxMessage(f.read()).get_json() + self.assertEqual(msg, expected) + if __name__ =3D=3D '__main__': main() --=20 2.14.3 (Apple Git-98) _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel