diff mbox

[v6,09/10] REST API: expose patch.checks

Message ID 1466111605-3059-10-git-send-email-andy.doan@linaro.org
State Accepted
Headers show

Commit Message

Andy Doan June 16, 2016, 9:13 p.m. UTC
Signed-off-by: Andy Doan <andy.doan@linaro.org>
Reviewed-by: Stephen Finucane <stephen.finucane@intel.com>
---
 patchwork/rest_serializers.py | 2 ++
 1 file changed, 2 insertions(+)
diff mbox

Patch

diff --git a/patchwork/rest_serializers.py b/patchwork/rest_serializers.py
index 962f875..bf6ed25 100644
--- a/patchwork/rest_serializers.py
+++ b/patchwork/rest_serializers.py
@@ -85,6 +85,7 @@  class PatchSerializer(URLSerializer):
         # there's no need to expose an entire "tags" endpoint, so we custom
         # render this field
         exclude = ('tags',)
+    check_names = dict(Check.STATE_CHOICES)
     mbox_url = SerializerMethodField()
     state = SerializerMethodField()
 
@@ -98,6 +99,7 @@  class PatchSerializer(URLSerializer):
     def to_representation(self, instance):
         data = super(PatchSerializer, self).to_representation(instance)
         data['checks_url'] = data['url'] + 'checks/'
+        data['check'] = self.check_names[instance.combined_check_state]
         headers = data.get('headers')
         if headers is not None:
             data['headers'] = email.parser.Parser().parsestr(headers, True)