Example #1
0
    def test_guardFilter_want_stable_no_stable(self):
        guard_fprint = 'guard fprint'
        rel_stat = mock.Mock()
        rel_stat.digest = 'guard digest'
        rel_stat.flags = (Flag.FAST)
        cons_rel_stats = {'guard fprint': rel_stat}
        descriptors = {'guard digest': 'guard desc'}
        fast = True
        stable = True
        exit_desc = 'exit desc'
        exit_status_entry = 'exit se'

        self.assertFalse(
            path.guardFilter(guard_fprint, cons_rel_stats, descriptors, fast,
                             stable, exit_desc, exit_status_entry))
Example #2
0
    def test_guardFilter_no_consensus_entry(self):
        guard_fprint = 'guard_fprint'
        cons_rel_stats = {}
        descriptors = {'guard_fprint': 'guard_desc'}
        fast = True
        stable = True
        exit_desc = 'exit desc'
        exit_status_entry = 'exit se'

        self.assertFalse(path.guardFilter(
            guard_fprint,
            cons_rel_stats,
            descriptors,
            fast,
            stable,
            exit_desc,
            exit_status_entry))
Example #3
0
    def test_guardFilter_no_descriptor(self):
        guard_fprint = 'guard fprint'
        rel_stat = mock.Mock()
        rel_stat.digest = 'guard digest'
        cons_rel_stats = {'guard fprint': rel_stat}
        descriptors = {}
        fast = True
        stable = True
        exit_desc = 'exit desc'
        exit_status_entry = 'exit se'

        self.assertFalse(path.guardFilter(
            guard_fprint,
            cons_rel_stats,
            descriptors,
            fast,
            stable,
            exit_desc,
            exit_status_entry))
Example #4
0
    def test_guardFilter(self, mock_nuwo):
        guard_fprint = 'guard fprint'
        rel_stat = mock.Mock()
        rel_stat.digest = 'guard digest'
        rel_stat.flags = (Flag.FAST, Flag.STABLE)
        cons_rel_stats = {'guard fprint': rel_stat}
        descriptors = {'guard digest': 'guard desc'}
        fast = True
        stable = True
        exit_desc = 'exit desc'
        exit_status_entry = 'exit se'

        self.assertEqual(path.guardFilter(
            guard_fprint,
            cons_rel_stats,
            descriptors,
            fast,
            stable,
            exit_desc,
            exit_status_entry), 'test val')