[tor-commits] [bridgedb/develop] Add unittest for str(Bridge) without fingerprint or nickname.

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


commit ce197f4997d7eaef7694d17081c0a3ce96bd974c
Author: Isis Lovecruft <isis at torproject.org>
Date:   Thu Mar 26 23:48:56 2015 +0000

    Add unittest for str(Bridge) without fingerprint or nickname.
---
 lib/bridgedb/test/test_bridges.py |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/lib/bridgedb/test/test_bridges.py b/lib/bridgedb/test/test_bridges.py
index 763e4c4..1592f00 100644
--- a/lib/bridgedb/test/test_bridges.py
+++ b/lib/bridgedb/test/test_bridges.py
@@ -912,6 +912,15 @@ class BridgeTests(unittest.TestCase):
                          ''.join(['$', '0'*40,
                                   '~', bridge.nickname]))
 
+    def test_Bridge_str_without_fingerprint_without_nickname(self):
+        """Calling str(Bridge) on a Bridge whose fingerprint and nickname were
+        not set should return a Bridge identifier string where the fingerprint
+        is all 0's and the nickname is "Unnamed".
+        """
+        bridge = bridges.Bridge()
+        identifier = str(bridge)
+        self.assertEqual(identifier, ''.join(['$', '0'*40, '~', 'Unnamed']))
+
     def test_Bridge_updateFromNetworkStatus_IPv4_ORAddress(self):
         """Calling updateFromNetworkStatus() with a descriptor which has an
         IPv4 address as an additional ORAddress should result in a





More information about the tor-commits mailing list