Ejemplo n.º 1
0
 def test_get_human_identifier(self):
     p0 = problem.list()[0]
     p3 = problem.list()[3]
     p4 = problem.list()[4]
     p0_t, p0_v = get_human_identifier(p0)
     p3_t, p3_v = get_human_identifier(p3)
     p4_t, p4_v = get_human_identifier(p4)
     self.assertEqual(p0_t, 'component')
     self.assertEqual(p0_v,  p0.component)
     self.assertEqual(p3_t, 'executable')
     self.assertEqual(p3_v,  p3.executable)
     self.assertEqual(p4_t, 'type')
     self.assertEqual(p4_v,  p4.type)
Ejemplo n.º 2
0
 def test_get_human_identifier(self):
     p0 = problem.list()[0]
     p3 = problem.list()[3]
     p4 = problem.list()[4]
     p0_t, p0_v = get_human_identifier(p0)
     p3_t, p3_v = get_human_identifier(p3)
     p4_t, p4_v = get_human_identifier(p4)
     self.assertEqual(p0_t, 'component')
     self.assertEqual(p0_v, p0.component)
     self.assertEqual(p3_t, 'executable')
     self.assertEqual(p3_v, p3.executable)
     self.assertEqual(p4_t, 'type')
     self.assertEqual(p4_v, p4.type)
Ejemplo n.º 3
0
    def test_fmt_problems(self):
        '''
        Test default problem formatting
        '''

        pl = problem.list()
        res = fmt_problems(pl)

        for prob in pl:
            self.assertIn(prob.short_id, res)
            field, value = get_human_identifier(prob)
            self.assertIn(value, res)
            self.assertIn(str(prob.count), res)

        self.assertIn('Bugzilla', res)
        self.assertIn('https://bugzilla.redhat.com/show_bug.cgi?id=1223349',
                      res)

        self.assertIn('ABRT Server', res)
        furl = 'https://retrace.fedoraproject.org/faf/reports/bthash/' \
               '3505a6db8a6bd51a3d690f1553b'
        self.assertIn(furl, res)

        self.assertIn('Not reportable', res)
        self.assertIn('Not reportable reason', res)
Ejemplo n.º 4
0
    def test_fmt_problems(self):
        '''
        Test default problem formatting
        '''

        pl = problem.list()
        res = fmt_problems(pl)

        for prob in pl:
            self.assertIn(prob.short_id, res)
            field, value = get_human_identifier(prob)
            self.assertIn(value, res)
            self.assertIn(str(prob.count), res)

        self.assertIn('Bugzilla', res)
        self.assertIn('https://bugzilla.redhat.com/show_bug.cgi?id=1223349',
                      res)

        self.assertIn('ABRT Server', res)
        furl = 'https://retrace.fedoraproject.org/faf/reports/bthash/' \
               '3505a6db8a6bd51a3d690f1553b'
        self.assertIn(furl, res)

        self.assertIn('Not reportable', res)
        self.assertIn('Not reportable reason', res)
Ejemplo n.º 5
0
def get_match_data(authenticate=False):
    '''
    Return tuple of two dictionaries: one with components as keys
    and one with short_ids as keys

    Utility function used by match_ functions
    '''

    by_human_id = {}
    by_short_id = {}
    by_path = {}

    for prob in problem.list(auth=authenticate):
        _, val = get_human_identifier(prob)

        if val in by_human_id:
            by_human_id[val].append(prob)
        else:
            by_human_id[val] = [prob]

        if prob.short_id in by_short_id:
            by_short_id[prob.short_id].append(prob)
        else:
            by_short_id[prob.short_id] = [prob]

        by_path[prob.path] = prob

    return by_human_id, by_short_id, by_path
Ejemplo n.º 6
0
Archivo: match.py Proyecto: abrt/abrt
def get_match_data(auth=False):
    '''
    Return tuple of two dictionaries: one with components as keys
    and one with short_ids as keys

    Utility function used by match_ functions
    '''

    by_human_id = {}
    by_short_id = {}

    for prob in problem.list(auth=auth):
        comp_or_exe, val = get_human_identifier(prob)

        if val in by_human_id:
            by_human_id[val].append(prob)
        else:
            by_human_id[val] = [prob]

        if prob.short_id in by_short_id:
            by_short_id[prob.short_id].append(prob)
        else:
            by_short_id[prob.short_id] = [prob]

    return by_human_id, by_short_id
Ejemplo n.º 7
0
def match_collision(probs):
    '''
    Handle matches that result in multiple problems by telling user
    to be more specific
    '''

    print(_('Ambiguous match specified resulting in multiple problems:'))
    for prob in probs:
        field, val = get_human_identifier(prob)
        print('- {}@{} ({})'.format(val, prob.short_id, prob.time))