[tor-commits] [bridgedb/develop] Add test for Bridge.setStatus() that exposes a bug.

isis at torproject.org isis at torproject.org
Sat Mar 28 02:50:58 UTC 2015


commit 581fec101457891c76f41bef14757f91c594b7f2
Author: Isis Lovecruft <isis at torproject.org>
Date:   Thu Mar 26 23:44:24 2015 +0000

    Add test for Bridge.setStatus() that exposes a bug.
    
    Doing:
    
      >>> from bridgedb import bridges
      >>> b = bridges.Bridge()
      >>> b.setStatus(stable=True)
    
    Results in:
    
      >>> b.stable
      True
      >>> b.flags.stable
      False
    
    When it should result in:
    
      >>> b.stable
      True
      >>> b.flags.stable
      True
---
 lib/bridgedb/test/test_bridges.py |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/lib/bridgedb/test/test_bridges.py b/lib/bridgedb/test/test_bridges.py
index cda052e..763e4c4 100644
--- a/lib/bridgedb/test/test_bridges.py
+++ b/lib/bridgedb/test/test_bridges.py
@@ -706,6 +706,24 @@ class BridgeBackwardsCompatibilityTests(unittest.TestCase):
         self.assertIsInstance(bridge, bridges.BridgeBackwardsCompatibility)
         self.assertEqual(len(bridge.orAddresses), 1)
 
+    def test_BridgeBackwardsCompatibility_setStatus_stable(self):
+        """Using setStatus() to set the Stable flag should set Bridge.stable
+        and Bridge.flags.stable to True.
+        """
+        bridge = bridges.BridgeBackwardsCompatibility(
+            nickname=self.nickname,
+            ip=self.address,
+            orport=self.orPort,
+            fingerprint=self.fingerprint,
+            or_addresses={"2006:42::123F": 443, "2006:42::123E": 9001})
+        self.assertIsInstance(bridge, bridges.BridgeBackwardsCompatibility)
+        self.assertFalse(bridge.stable)
+        self.assertFalse(bridge.flags.stable)
+
+        bridge.setStatus(stable=True)
+        self.assertTrue(bridge.stable)
+        self.assertTrue(bridge.flags.stable)
+
     def test_BridgeBackwardsCompatibility_setStatus_running(self):
         """Using setStatus() to set the Running flag should set Bridge.running
         and Bridge.flags.running to True.





More information about the tor-commits mailing list