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

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



commit 581fec101457891c76f41bef14757f91c594b7f2
Author: Isis Lovecruft <isis@xxxxxxxxxxxxxx>
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.



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