[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [bridgedb/develop] Merge remote-tracking branch 'tpo-sysrqb/bug12781-dumpbuckets_constification_2' into develop



commit cfd71bee10489d216ed67bdc02cdb4f68e1230e0
Merge: 2f0ea18 deada72
Author: Isis Lovecruft <isis@xxxxxxxxxxxxxx>
Date:   Wed Aug 20 06:59:46 2014 +0000

    Merge remote-tracking branch 'tpo-sysrqb/bug12781-dumpbuckets_constification_2' into develop
    
    Conflicts:
    	lib/bridgedb/Bucket.py
    	lib/bridgedb/test/test_Bucket.py

 lib/bridgedb/Bucket.py           |    9 ++++++---
 lib/bridgedb/test/test_Bucket.py |    4 ++--
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --cc lib/bridgedb/Bucket.py
index 5b33a36,40a8a32..5e7f61b
--- a/lib/bridgedb/Bucket.py
+++ b/lib/bridgedb/Bucket.py
@@@ -37,16 -37,15 +37,20 @@@ toHex = binascii.b2a_he
  # distinguish them from real distributors?
  PSEUDO_DISTRI_PREFIX = "pseudo_"
  
+ # Set to rediculously high number
+ BUCKET_MAX_BRIDGES = 1000000
+ 
 -class BucketData:
 -    """A file bucket value class.
 -       name      - Name of the bucket (From config), prefixed by pseudo
 -                   distributor prefix
 -       needed    - Needed number of bridges for that bucket (From config)
 -       allocated - Number of already allocated bridges for that bucket
++
 +class BucketData(object):
 +    """Configures a bridge bucket with the number of bridges which should be
 +    allocated, the name of the bucket, and other similar data.
 +
 +    :param str name: The name of this bucket (from the config file). This will
 +        be prefixed by the :data:`PSEUDO_DISTRIBUTOR_PREFIX`.
 +    :type needed: str or int
 +    :param needed: The number of bridges needed for this bucket (also from the
 +        config file).
 +    :param int allocated: Number of bridges already allocated for this bucket.
      """
      def __init__(self, name, needed):
          self.name = name
diff --cc lib/bridgedb/test/test_Bucket.py
index 2912ae1,82424b6..5e39260
--- a/lib/bridgedb/test/test_Bucket.py
+++ b/lib/bridgedb/test/test_Bucket.py
@@@ -31,19 -29,19 +31,19 @@@ class BucketDataTest(unittest.TestCase)
  
      def test_alloc_some_of_the_bridges(self):
          """Set the needed number of bridges"""
 -        alloc = 10
 +        needed = 10
          distname = "test-distributor"
 -        bucket = Bucket.BucketData(distname, alloc)
 -        this(distname).should.be.equal(bucket.name)
 -        this(Bucket.BUCKET_MAX_BRIDGES).should.be.equal(bucket.needed)
 +        bucket = Bucket.BucketData(distname, needed)
 +        this(bucket.name).should.be.equal(distname)
-         this(bucket.needed).should.be.equal(needed)
++        this(bucket.needed).should.be.equal(Bucket.BUCKET_MAX_BRIDGES)
  
      def test_alloc_all_the_bridges(self):
          """Set the needed number of bridges to the default"""
 -        alloc = '*'
 +        needed = '*'
          distname = "test-distributor"
 -        bucket = Bucket.BucketData(distname, alloc)
 -        this(distname).should.be.equal(bucket.name)
 -        this(Bucket.BUCKET_MAX_BRIDGES).should.be.equal(bucket.needed)
 +        bucket = Bucket.BucketData(distname, needed)
 +        this(bucket.name).should.be.equal(distname)
-         this(bucket.needed).should.be.equal(needed)
++        this(bucket.needed).should.be.equal(Bucket.BUCKET_MAX_BRIDGES)
  
  
  class BucketManagerTest(unittest.TestCase):



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits