Ejemplo n.º 1
0
    def test_match_lookup_collisions(self):
        '''
        Test match lookup handles collisions
        '''

        m = match_lookup(self.collision_hash)
        self.assertTrue(len(m) == 2)

        m = match_lookup(self.collision_human)
        self.assertTrue(len(m) == 2)
Ejemplo n.º 2
0
    def test_match_lookup_collisions(self):
        '''
        Test match lookup handles collisions
        '''

        m = match_lookup(self.collision_hash)
        self.assertTrue(len(m) == 2)

        m = match_lookup(self.collision_human)
        self.assertTrue(len(m) == 2)
Ejemplo n.º 3
0
    def test_match_lookup_nonexistent(self):
        '''
        Test match lookup handles empty input
        '''

        m = match_lookup('')
        self.assertEqual(m, None)
Ejemplo n.º 4
0
    def test_match_lookup_nonexistent(self):
        '''
        Test match lookup handles empty input
        '''

        m = match_lookup('')
        self.assertEqual(m, None)
Ejemplo n.º 5
0
    def test_match_lookup_combined(self):
        '''
        Test match lookup by human id
        '''

        for h in self.combined:
            m = match_lookup(h)
            self.assertTrue(len(m) == 1)
Ejemplo n.º 6
0
    def test_match_lookup_human_id(self):
        '''
        Test match lookup by human id
        '''

        for h in self.human:
            m = match_lookup(h)
            self.assertTrue(len(m) == 1)
Ejemplo n.º 7
0
    def test_match_lookup_hash(self):
        '''
        Test match lookup by hash
        '''

        for h in self.hashes:
            m = match_lookup(h)
            self.assertTrue(len(m) >= 1)
Ejemplo n.º 8
0
    def test_match_lookup_combined(self):
        '''
        Test match lookup by human id
        '''

        for h in self.combined:
            m = match_lookup(h)
            self.assertTrue(len(m) == 1)
Ejemplo n.º 9
0
    def test_match_lookup_human_id(self):
        '''
        Test match lookup by human id
        '''

        for h in self.human:
            m = match_lookup(h)
            self.assertTrue(len(m) == 1)
Ejemplo n.º 10
0
    def test_match_lookup_hash(self):
        '''
        Test match lookup by hash
        '''

        for h in self.hashes:
            m = match_lookup(h)
            self.assertTrue(len(m) >= 1)
Ejemplo n.º 11
0
 def test_match_combo(self):
     '''
     Test matching based on combinations of criteria
     '''
     since = datetime.datetime(2015, 5, 1)
     until = datetime.datetime(2015, 7, 1)
     matches = match_lookup(['bc60a5cbddb4e3667511e718ceecac16133acc97'],
                            since=since.timestamp(),
                            until=until.timestamp(),
                            not_reported=True)
     self.assertEqual(len(matches), 1)
     matches = match_lookup(['bc60a5cbddb4e3667511e718ceecac16133acc97'],
                            since=since.timestamp(),
                            until=until.timestamp())
     self.assertEqual(len(matches), 2)
     matches = match_lookup(['bc60a5cbddb4e3667511e718ceecac16133acc97'],
                            components=['pavucontrol'],
                            since=since.timestamp(),
                            n_latest=1)
     self.assertEqual(len(matches), 1)
Ejemplo n.º 12
0
 def run(self, arguments):
     problems = match_lookup(['*'],
                             authenticate=arguments.authenticate,
                             executables=arguments.executables,
                             components=arguments.components,
                             since=arguments.since,
                             until=arguments.until,
                             n_latest=arguments.n_latest,
                             not_reported=arguments.not_reported)
     if problems:
         fmt = arguments.format
         if not fmt:
             fmt = getattr(config, '%s_FMT' % (arguments.pretty.upper()))
         print(format_problems(problems, fmt=fmt))
     else:
         print(_('No problems'))
Ejemplo n.º 13
0
    def run(self, arguments):
        problems = match_lookup(['*'],
                                authenticate=arguments.authenticate,
                                executables=arguments.executables,
                                components=arguments.components,
                                since=arguments.since,
                                until=arguments.until,
                                n_latest=arguments.n_latest,
                                not_reported=arguments.not_reported)

        since_append = ''
        if arguments.since:
            since_append = ' --since {}'.format(arguments.since)

        if arguments.bare:
            print(len(problems))
            return

        if not arguments.quiet or problems:
            print(
                N_(
                    'ABRT has detected a problem. For more information, run “abrt list{}”',
                    'ABRT has detected %d problems. For more information, run “abrt list{}”'
                    % (len(problems)), len(problems)).format(since_append))