From 329487234285e3ee778dd1b852db47a9c9f6962c Mon Sep 17 00:00:00 2001
From: Matt Jia <mjia@redhat.com>
Date: Oct 23 2017 06:21:30 +0000
Subject: add a corresponding test change for #PR97


---

diff --git a/functional-tests/consumers/test_resultsdb.py b/functional-tests/consumers/test_resultsdb.py
index 1f147b7..9551019 100644
--- a/functional-tests/consumers/test_resultsdb.py
+++ b/functional-tests/consumers/test_resultsdb.py
@@ -20,16 +20,18 @@ def test_consume_new_result(
                                            testcase_name='dist.rpmdeplint',
                                            outcome='PASSED')
     message = {
-        'topic': 'taskotron.result.new',
-        'msg': {
-            'result': {
-                'id': result['id'],
-                'outcome': 'PASSED'
-            },
-            'task': {
-                'item': nvr,
-                'type': 'koji_build',
-                'name': 'dist.rpmdeplint'
+        'body': {
+            'topic': 'taskotron.result.new',
+            'msg': {
+                'result': {
+                    'id': result['id'],
+                    'outcome': 'PASSED'
+                },
+                'task': {
+                    'item': nvr,
+                    'type': 'koji_build',
+                    'name': 'dist.rpmdeplint'
+                }
             }
         }
     }
@@ -110,16 +112,18 @@ def test_no_message_for_unchanged_decision(
         testcase_name='dist.rpmdeplint',
         outcome='PASSED')
     message = {
-        'topic': 'taskotron.result.new',
-        'msg': {
-            'result': {
-                'id': new_result['id'],
-                'outcome': 'PASSED'
-            },
-            'task': {
-                'item': nvr,
-                'type': 'koji_build',
-                'name': 'dist.rpmdeplint'
+        'body': {
+            'topic': 'taskotron.result.new',
+            'msg': {
+                'result': {
+                    'id': new_result['id'],
+                    'outcome': 'PASSED'
+                },
+                'task': {
+                    'item': nvr,
+                    'type': 'koji_build',
+                    'name': 'dist.rpmdeplint'
+                }
             }
         }
     }
@@ -149,16 +153,18 @@ def test_invalidate_new_result_with_mocked_cache(
     result = testdatabuilder.create_result(
         item=nvr, testcase_name='dist.rpmdeplint', outcome='PASSED')
     message = {
-        'topic': 'taskotron.result.new',
-        'msg': {
-            'result': {
-                'id': result['id'],
-                'outcome': 'PASSED'
-            },
-            'task': {
-                'item': nvr,
-                'type': 'koji_build',
-                'name': 'dist.rpmdeplint'
+        'body': {
+            'topic': 'taskotron.result.new',
+            'msg': {
+                'result': {
+                    'id': result['id'],
+                    'outcome': 'PASSED'
+                },
+                'task': {
+                    'item': nvr,
+                    'type': 'koji_build',
+                    'name': 'dist.rpmdeplint'
+                }
             }
         }
     }
@@ -221,16 +227,18 @@ def test_invalidate_new_result_with_real_cache(
 
     # Now, handle a message about the new failing result
     message = {
-        u'topic': u'taskotron.result.new',
-        u'msg': {
-            u'result': {
-                u'id': u'whatever',
-                u'outcome': u'doesn\'t matter',
-            },
-            u'task': {
-                u'item': nvr.decode('utf-8'),
-                u'type': u'koji_build',
-                u'name': u'dist.rpmdeplint'
+        'body': {
+            u'topic': u'taskotron.result.new',
+            u'msg': {
+                u'result': {
+                    u'id': u'whatever',
+                    u'outcome': u'doesn\'t matter',
+                },
+                u'task': {
+                    u'item': nvr.decode('utf-8'),
+                    u'type': u'koji_build',
+                    u'name': u'dist.rpmdeplint'
+                }
             }
         }
     }
@@ -272,16 +280,18 @@ def test_invalidate_new_result_with_no_preexisting_cache(
     result = testdatabuilder.create_result(
         item=nvr, testcase_name='dist.rpmdeplint', outcome='PASSED')
     message = {
-        'topic': 'taskotron.result.new',
-        'msg': {
-            'result': {
-                'id': result['id'],
-                'outcome': 'PASSED'
-            },
-            'task': {
-                'item': nvr,
-                'type': 'koji_build',
-                'name': 'dist.rpmdeplint'
+        'body': {
+            'topic': 'taskotron.result.new',
+            'msg': {
+                'result': {
+                    'id': result['id'],
+                    'outcome': 'PASSED'
+                },
+                'task': {
+                    'item': nvr,
+                    'type': 'koji_build',
+                    'name': 'dist.rpmdeplint'
+                }
             }
         }
     }
diff --git a/functional-tests/consumers/test_waiverdb.py b/functional-tests/consumers/test_waiverdb.py
index 679a0e1..5b0ff5a 100644
--- a/functional-tests/consumers/test_waiverdb.py
+++ b/functional-tests/consumers/test_waiverdb.py
@@ -30,15 +30,17 @@ def test_consume_new_waiver(
                                       outcome='PASSED')
     waiver = testdatabuilder.create_waiver(result_id=result['id'], product_version='fedora-26')
     message = {
-        'topic': 'waiver.new',
-        "msg": {
-            "id": waiver['id'],
-            "comment": "Because I said so",
-            "username": "foo",
-            "waived": "true",
-            "timestamp": "2017-08-10T17:42:04.209638",
-            "product_version": "fedora-26",
-            "result_id": result['id'],
+        'body': {
+            'topic': 'waiver.new',
+            "msg": {
+                "id": waiver['id'],
+                "comment": "Because I said so",
+                "username": "foo",
+                "waived": "true",
+                "timestamp": "2017-08-10T17:42:04.209638",
+                "product_version": "fedora-26",
+                "result_id": result['id'],
+            }
         }
     }
     hub = mock.MagicMock()
diff --git a/greenwave/consumers/waiverdb.py b/greenwave/consumers/waiverdb.py
index 0cba417..bea36d1 100644
--- a/greenwave/consumers/waiverdb.py
+++ b/greenwave/consumers/waiverdb.py
@@ -58,6 +58,7 @@ class WaiverDBHandler(fedmsg.consumers.FedmsgConsumer):
         Args:
             message (munch.Munch): A fedmsg about a new waiver.
         """
+        message = message.get('body', message)
         log.debug('Processing message "%s"', message)
         msg = message['msg']
         result_id = msg['result_id']

