def test_middleFilter_want_fast_no_fast(self): middle_fprint = 'middle fprint' rel_stat = mock.Mock() rel_stat.flags = (Flag.RUNNING) rel_stat.digest = 'middle digest' cons_rel_stats = {'middle fprint': rel_stat} desc = mock.Mock() desc.ntor_onion_key = 'ntor-onion-key' descriptors = {'middle digest': desc} fast = True stable = True exit_desc = 'exit desc' exit_status_entry = 'exit se' guard_desc = 'guard desc' guard_status_entry = 'guard se' self.assertFalse(path.middleFilter( middle_fprint, cons_rel_stats, descriptors, exit_desc, exit_status_entry, guard_desc, guard_status_entry, fast, stable))
def test_middleFilter(self, mock_nuwo): middle_fprint = 'middle fprint' rel_stat = mock.Mock() rel_stat.flags = (Flag.RUNNING, Flag.FAST, Flag.STABLE) rel_stat.digest = 'middle digest' cons_rel_stats = {'middle fprint': rel_stat} desc = mock.Mock() desc.ntor_onion_key = 'ntor-onion-key' descriptors = {'middle digest': desc} fast = True stable = True exit_desc = 'exit desc' exit_status_entry = 'exit se' guard_desc = 'guard desc' guard_status_entry = 'guard se' self.assertEqual(path.middleFilter( middle_fprint, cons_rel_stats, descriptors, exit_desc, exit_status_entry, guard_desc, guard_status_entry, fast, stable), 'test val')
def test_middleFilter_no_consensus_entry(self): middle_fprint = 'middle fprint' cons_rel_stats = {} descriptors = {'middle fprint': 'middle desc'} fast = True stable = True exit_desc = 'exit desc' exit_status_entry = 'exit se' guard_desc = 'guard desc' guard_status_entry = 'guard se' self.assertFalse( path.middleFilter(middle_fprint, cons_rel_stats, descriptors, exit_desc, exit_status_entry, guard_desc, guard_status_entry, fast, stable))
def test_middleFilter_no_descriptor(self): middle_fprint = 'middle fprint' rel_stat = mock.Mock() rel_stat.digest = 'middle digest' cons_rel_stats = {'middle fprint': rel_stat} descriptors = {} fast = True stable = True exit_desc = 'exit desc' exit_status_entry = 'exit se' guard_desc = 'guard desc' guard_status_entry = 'guard se' self.assertFalse( path.middleFilter(middle_fprint, cons_rel_stats, descriptors, exit_desc, exit_status_entry, guard_desc, guard_status_entry, fast, stable))
def test_middleFilter(self, mock_nuwo): middle_fprint = 'middle fprint' rel_stat = mock.Mock() rel_stat.flags = (Flag.RUNNING, Flag.FAST, Flag.STABLE) rel_stat.digest = 'middle digest' cons_rel_stats = {'middle fprint': rel_stat} desc = mock.Mock() desc.ntor_onion_key = 'ntor-onion-key' descriptors = {'middle digest': desc} fast = True stable = True exit_desc = 'exit desc' exit_status_entry = 'exit se' guard_desc = 'guard desc' guard_status_entry = 'guard se' self.assertEqual( path.middleFilter(middle_fprint, cons_rel_stats, descriptors, exit_desc, exit_status_entry, guard_desc, guard_status_entry, fast, stable), 'test val')
def test_middleFilter_want_fast_no_fast(self): middle_fprint = 'middle fprint' rel_stat = mock.Mock() rel_stat.flags = (Flag.RUNNING) rel_stat.digest = 'middle digest' cons_rel_stats = {'middle fprint': rel_stat} desc = mock.Mock() desc.ntor_onion_key = 'ntor-onion-key' descriptors = {'middle digest': desc} fast = True stable = True exit_desc = 'exit desc' exit_status_entry = 'exit se' guard_desc = 'guard desc' guard_status_entry = 'guard se' self.assertFalse( path.middleFilter(middle_fprint, cons_rel_stats, descriptors, exit_desc, exit_status_entry, guard_desc, guard_status_entry, fast, stable))
def test_middleFilter_no_consensus_entry(self): middle_fprint = 'middle fprint' cons_rel_stats = {} descriptors = {'middle fprint': 'middle desc'} fast = True stable = True exit_desc = 'exit desc' exit_status_entry = 'exit se' guard_desc = 'guard desc' guard_status_entry = 'guard se' self.assertFalse(path.middleFilter( middle_fprint, cons_rel_stats, descriptors, exit_desc, exit_status_entry, guard_desc, guard_status_entry, fast, stable))
def test_middleFilter_no_descriptor(self): middle_fprint = 'middle fprint' rel_stat = mock.Mock() rel_stat.digest = 'middle digest' cons_rel_stats = {'middle fprint': rel_stat} descriptors = {} fast = True stable = True exit_desc = 'exit desc' exit_status_entry = 'exit se' guard_desc = 'guard desc' guard_status_entry = 'guard se' self.assertFalse(path.middleFilter( middle_fprint, cons_rel_stats, descriptors, exit_desc, exit_status_entry, guard_desc, guard_status_entry, fast, stable))