#99 add a corresponding test change for #PR97
Merged 6 years ago by ralph. Opened 6 years ago by mjia.
mjia/greenwave fix_tests  into  master

@@ -20,16 +20,18 @@ 

                                             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 @@ 

          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 @@ 

      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 @@ 

  

      # 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 @@ 

      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'

+                 }

              }

          }

      }

@@ -30,15 +30,17 @@ 

                                        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()

@@ -58,6 +58,7 @@ 

          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']

no initial comment

Pull-Request has been merged by ralph

6 years ago

Hmm now I'm confused... after we merged #97 I thought I ran all the tests and they still passed. :thinking:

Heh, somebody should implement the :thinking: emoji shortcut on Pagure, that is by far my most commonly used emoji :-P

Ohh never mind. I see now. The patch for #97 actually supports either unpacking the 'body' envelope, or not -- it will accept either. I didn't notice that at first glance.

So these tests do correctly fail if you take out the fix from #97. Which is good :-)