def _attach(self,
                bug_id,
                filename,
                description,
                is_patch=False,
                reviewer=None,
                content_type='text/plain'):
        """Create a new attachment."""
        fields = {
            'data': base64.b64encode(open(filename).read()),
            'encoding': 'base64',
            'file_name': filename,
            'content_type': content_type,
            'description': description,
            'is_patch': is_patch,
        }

        if reviewer is not None:
            fields['flags'] = [
                Flag(type_id=REVIEW, status='?', requestee=reviewer)
            ]

        url = urljoin(self.API_ROOT,
                      'bug/%s/attachment?%s' % (bug_id, self.qs()))
        return Attachment(**fields).post_to(url)
Exemplo n.º 2
0
    def get_bug(self, bug, include_fields='_default,token,cc,keywords,whiteboard,comments', exclude_fields=None, params={}):
        params['include_fields'] = [include_fields]
        params['exclude_fields'] = [exclude_fields]

        url = urljoin(self.API_ROOT, 'bug/%s?%s' % (bug, self.qs(**params)))
        try:
            return Bug.get(url)
        except Exception as e:
            raise Exception(hide_personal_info(str(e)))
Exemplo n.º 3
0
    def get_bug(self, bug, include_fields='_default', exclude_fields=None, params={}):
        params['include_fields'] = [include_fields]
        params['exclude_fields'] = [exclude_fields]

        url = urljoin(self.API_ROOT, 'bug/%s?%s' % (bug, qs(**params)))
        try:
            return BugSearch.get(url, http=self.http).bugs[0]
        except Exception as e:
            raise Exception(hide_personal_info(str(e)))
Exemplo n.º 4
0
    def get_bug(self, bug, include_fields='_default,token,cc,keywords,whiteboard,comments', exclude_fields=None, params={}):
        params['include_fields'] = [include_fields]
        params['exclude_fields'] = [exclude_fields]

        url = urljoin(self.API_ROOT, 'bug/%s?%s' % (bug, self.qs(**params)))
        try:
            return Bug.get(url)
        except Exception, e:
            raise Exception(hide_personal_info(str(e)))
    def get_bug(self, bug, include_fields='_default', exclude_fields=None, params={}):
        params['include_fields'] = [include_fields]
        params['exclude_fields'] = [exclude_fields]

        url = urljoin(self.API_ROOT, 'bug/%s?%s' % (bug, qs(**params)))
        try:
            return BugSearch.get(url, http=self.http).bugs[0]
        except Exception as e:
            raise Exception(hide_personal_info(str(e)))
Exemplo n.º 6
0
    def test_urljoin(self):
        url = urljoin(
            BZ_API_ROOT, 'bug/%s/attachment?%s' %
            (1233, '&changed_before=' +
             '2010-12-26&product=Core,Firefox&changed_field=status&' +
             'changed_after=2010-12-24&include_fields=_default,' +
             'attachments&changed_field_to=RESOLVED&resolution=FIXED'))

        expected_url = BZ_API_ROOT + 'bug/1233/' + \
            'attachment?&changed_before=2010-12-26&product=Core,Firefox&' + \
            'changed_field=status&changed_after=2010-12-24&include_fields=' + \
            '_default,attachments&changed_field_to=RESOLVED&resolution=FIXED'
        assert_equals(url, expected_url)
Exemplo n.º 7
0
    def test_urljoin(self):
        url = urljoin(
            BZ_API_ROOT, 'bug/%s/attachment?%s' %
            (1233, '&changed_before=' +
                '2010-12-26&product=Core,Firefox&changed_field=status&' +
                'changed_after=2010-12-24&include_fields=_default,' +
                'attachments&changed_field_to=RESOLVED&resolution=FIXED'))

        expected_url = BZ_API_ROOT + 'bug/1233/' + \
            'attachment?&changed_before=2010-12-26&product=Core,Firefox&' + \
            'changed_field=status&changed_after=2010-12-24&include_fields=' + \
            '_default,attachments&changed_field_to=RESOLVED&resolution=FIXED'
        assert_equals(url, expected_url)
Exemplo n.º 8
0
    def _attach(self, bug_id, filename, description, is_patch=False,
                reviewer=None, content_type='text/plain'):
        """Create a new attachment."""
        fields = {
            'data': base64.b64encode(open(filename).read()),
            'encoding': 'base64',
            'file_name': filename,
            'content_type': content_type,
            'description': description,
            'is_patch': is_patch,
        }

        if reviewer is not None:
            fields['flags'] = [Flag(type_id=REVIEW, status='?',
                                    requestee=reviewer)]

        url = urljoin(self.API_ROOT, 'bug/%s/attachment?%s' % (bug_id, self.qs()))
        return Attachment(**fields).post_to(url)
Exemplo n.º 9
0
 def get_bug_list(self, params={}):
     url = urljoin(self.API_ROOT, 'bug/?%s' % (self.qs(**params)))
     try:
         return BugSearch.get(url).bugs
     except Exception as e:
         raise Exception(hide_personal_info(str(e)))
 def _comment(self, bug_id, comment):
     """Create a new comment."""
     url = urljoin(self.API_ROOT, 'bug/%s/comment?%s' % (bug_id, self.qs()))
     return Comment(text=comment).post_to(url)
Exemplo n.º 11
0
 def get_bug_list(self, params={}):
     url = urljoin(self.API_ROOT, 'bug?%s' % (qs(**params)))
     try:
         return BugSearch.get(url, http=self.http).bugs
     except Exception as e:
         raise Exception(hide_personal_info(str(e)))
Exemplo n.º 12
0
 def _comment(self, bug_id, comment):
     """Create a new comment."""
     url = urljoin(self.API_ROOT, 'bug/%s/comment?%s' % (bug_id, self.qs()))
     return Comment(text=comment).post_to(url)