[tor-commits] [bridgedb/master] Remove testDistWithFilterBlockedCountries() from legacy_Tests.
isis at torproject.org
isis at torproject.org
Sat Jul 25 19:26:22 UTC 2015
commit e9713d2a58566b761a68544d552ae5e702008a2d
Author: Isis Lovecruft <isis at torproject.org>
Date: Sun Apr 19 05:03:40 2015 +0000
Remove testDistWithFilterBlockedCountries() from legacy_Tests.
The functionality tested in testDistWithFilterBlockedCountries() is now
tested in test_Dist.test_HTTPSDistributor_with_blocked_bridges() and
test_Dist.test_HTTPSDistributor_with_some_blocked_bridges().
---
lib/bridgedb/test/legacy_Tests.py | 26 --------------------------
lib/bridgedb/test/test_Dist.py | 2 ++
2 files changed, 2 insertions(+), 26 deletions(-)
diff --git a/lib/bridgedb/test/legacy_Tests.py b/lib/bridgedb/test/legacy_Tests.py
index 4cdcc03..fc4ca5d 100644
--- a/lib/bridgedb/test/legacy_Tests.py
+++ b/lib/bridgedb/test/legacy_Tests.py
@@ -303,32 +303,6 @@ class IPBridgeDistTests(unittest.TestCase):
filterBridgesByIP4, filterBridgesByIP6])
assert len(b) == 0
- def testDistWithFilterBlockedCountries(self):
- d = bridgedb.Dist.HTTPSDistributor(3, "Foo")
- for _ in xrange(250):
- d.insert(fakeBridge6(or_addresses=True))
- d.insert(fakeBridge(or_addresses=True))
-
- for b in d.hashring.bridges:
- # china blocks all :-(
- for pt in b.transports:
- key = "%s:%s" % (pt.address, pt.port)
- b.blockingCountries[key] = set(['cn'])
- for address, portlist in b.or_addresses.items():
- for port in portlist:
- key = "%s:%s" % (address, port)
- b.blockingCountries[key] = set(['cn'])
- key = "%s:%s" % (b.ip, b.orport)
- b.blockingCountries[key] = set(['cn'])
-
- for i in xrange(5):
- b = d.getBridges(randomIPv4String(), "x", bridgeFilterRules=[
- filterBridgesByNotBlockedIn("cn")])
- assert len(b) == 0
- b = d.getBridges(randomIPv4String(), "x", bridgeFilterRules=[
- filterBridgesByNotBlockedIn("us")])
- assert len(b) > 0
-
def testDistWithFilterBlockedCountriesAdvanced(self):
d = bridgedb.Dist.HTTPSDistributor(3, "Foo")
for _ in xrange(250):
diff --git a/lib/bridgedb/test/test_Dist.py b/lib/bridgedb/test/test_Dist.py
index 3de7945..2d93a19 100644
--- a/lib/bridgedb/test/test_Dist.py
+++ b/lib/bridgedb/test/test_Dist.py
@@ -230,6 +230,7 @@ class HTTPSDistributorTests(unittest.TestCase):
bridges = dist.getBridges(clientRequest1, 1)
for b in bridges:
self.assertFalse(b.isBlockedIn('cn'))
+ self.assertNotIn(b.fingerprint, blockedCN)
# The client *should* have gotten some bridges still.
self.assertGreater(len(bridges), 0)
@@ -237,4 +238,5 @@ class HTTPSDistributorTests(unittest.TestCase):
bridges = dist.getBridges(clientRequest2, 1)
for b in bridges:
self.assertFalse(b.isBlockedIn('ir'))
+ self.assertNotIn(b.fingerprint, blockedIR)
self.assertGreater(len(bridges), 0)
More information about the tor-commits
mailing list