#97 Likely a KeyError here.
Merged 6 years ago by jskladan. Opened 6 years ago by ralph.

file modified
+2 -2
@@ -151,11 +151,11 @@ 

  

          # For the v1 API

          if hasattr(result, 'job'):

-             msg['msg']['result']['job_url'] = result.job.ref_url

+             msg['result']['job_url'] = result.job.ref_url

  

          # For the v2 API

          if hasattr(result, 'group'):

-             msg['msg']['result']['group_url'] = result.group.ref_url

+             msg['result']['group_url'] = result.group.ref_url

  

          return msg

  

Your word on messaging code is canon to me. Merging with thanks!

Pull-Request has been merged by jskladan

6 years ago

Finding myself now wishing we had covered this with tests last year.

Oh you know what... the branch for the v2 API, with the condition if hasattr(result, 'group') actually can never be taken as far as I can see. That's because the attribute is actually result.groups and not result.group...

Moral of the story, let's cover all this stuff with tests :-)

The result.job attribute also hasn't existed since the commit introducing API v2. Seems like the create_fedmsg() function regressed in that commit (both copies of it). As did the ability to POST /api/v1.0/jobs which I also discovered when trying to write a test for it. Yikes...

Metadata