def test_linkify_validation_messages(self, v):
     v.return_value = json.dumps({
         "errors": 0,
         "success": True,
         "warnings": 1,
         "notices": 0,
         "message_tree": {},
         "messages": [{
             "context": ["<code>", None],
             "description": [
                 "Something something, see https://bugzilla.mozilla.org/"],
             "column": 0,
             "line": 1,
             "file": "chrome/content/down.html",
             "tier": 2,
             "message": "Some warning",
             "type": "warning",
             "id": [],
             "uid": "bb9948b604b111e09dfdc42c0301fe38"
         }],
         "metadata": {}
     })
     r = self.client.post(reverse('devhub.json_file_validation',
                                  args=[self.addon.slug, self.file.id]),
                          follow=True)
     eq_(r.status_code, 200)
     data = json.loads(r.content)
     assert_no_validation_exceptions(data)
     doc = pq(data['validation']['messages'][0]['description'][0])
     eq_(doc('a').text(), 'https://bugzilla.mozilla.org/')
 def test_lazy_validate(self):
     r = self.client.post(reverse('devhub.json_file_validation',
                                  args=[self.addon.slug, self.file.id]),
                          follow=True)
     eq_(r.status_code, 200)
     data = json.loads(r.content)
     assert_no_validation_exceptions(data)
     msg = data['validation']['messages'][0]
     ok_('is invalid' in msg['message'])
 def test_validator_sets_binary_flag_for_content(self, v):
     v.return_value = json.dumps({
         "errors": 0,
         "success": True,
         "warnings": 0,
         "notices": 0,
         "message_tree": {},
         "messages": [],
         "metadata": {
             "contains_binary_content": True,
             "version": "1.0",
             "name": "gK0Bes Bot",
             "id": "gkobes@gkobes"
         }
     })
     eq_(self.addon.binary, False)
     r = self.client.post(reverse('devhub.json_file_validation',
                                  args=[self.addon.slug, self.file.id]),
                          follow=True)
     eq_(r.status_code, 200)
     data = json.loads(r.content)
     assert_no_validation_exceptions(data)
     addon = Addon.objects.get(pk=self.addon.id)
     eq_(addon.binary, True)