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

[tor-commits] [stem/master] Missing files for prior commit



commit 84664f1d6f388c93ff686dd049dfe48804ead41f
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Sat Jan 12 21:07:47 2013 -0800

    Missing files for prior commit
    
    Oops. Did a 'git commit -a' while forgetting that we were adding a couple new
    files.
---
 test/integ/descriptor/data/bridge_network_status   |   18 ++++++++
 .../descriptor/networkstatus/bridge_document.py    |   45 ++++++++++++++++++++
 2 files changed, 63 insertions(+), 0 deletions(-)

diff --git a/test/integ/descriptor/data/bridge_network_status b/test/integ/descriptor/data/bridge_network_status
new file mode 100644
index 0000000..ad07672
--- /dev/null
+++ b/test/integ/descriptor/data/bridge_network_status
@@ -0,0 +1,18 @@
+@type bridge-network-status 1.0
+published 2012-06-01 04:07:04
+r Unnamed ABSiBVJ42z6w5Z6nAXQUFq8YVVg FI74aFuNJZZQrgln0f+OaocMd0M 2012-05-31 15:57:00 10.97.236.247 443 0
+s Valid
+w Bandwidth=55
+p reject 1-65535
+r TolFuin AFn9TveYjdtZEsgh7QsWp3qC5kU 1Sw8RPx2Tq/w+VHL+pZipiJUG5k 2012-05-31 18:12:39 10.99.47.37 80 0
+s Fast Guard Running Stable Valid
+w Bandwidth=32
+p reject 1-65535
+r sidvic AGzeXR+V8NSBE3wTE4m7gBYbjWM 7enyDQ20UjliwCPN2JmTl6zrCdM 2012-05-31 22:56:12 10.145.17.182 80 0
+s Fast Guard Running Stable Valid
+w Bandwidth=56
+p reject 1-65535
+r AntoniusBlock ANk5reA3WwTV62ZpyMo+NWtrvAw gEgv8I1E4LWrs394Xx/cRYQUL5A 2012-05-31 17:21:20 10.95.68.0 443 0
+s Fast Guard Running Stable Valid
+w Bandwidth=55
+p reject 1-65535
diff --git a/test/unit/descriptor/networkstatus/bridge_document.py b/test/unit/descriptor/networkstatus/bridge_document.py
new file mode 100644
index 0000000..322b5a9
--- /dev/null
+++ b/test/unit/descriptor/networkstatus/bridge_document.py
@@ -0,0 +1,45 @@
+"""
+Unit tests for the BridgeNetworkStatusDocument of stem.descriptor.networkstatus.
+"""
+
+import datetime
+import unittest
+
+from stem.descriptor.networkstatus import BridgeNetworkStatusDocument
+
+DOCUMENT = """\
+published 2012-06-01 04:07:04
+r Unnamed ABSiBVJ42z6w5Z6nAXQUFq8YVVg FI74aFuNJZZQrgln0f+OaocMd0M 2012-05-31 15:57:00 10.97.236.247 443 0
+s Valid
+w Bandwidth=55
+p reject 1-65535
+r TolFuin AFn9TveYjdtZEsgh7QsWp3qC5kU 1Sw8RPx2Tq/w+VHL+pZipiJUG5k 2012-05-31 18:12:39 10.99.47.37 80 0
+s Fast Guard Running Stable Valid
+w Bandwidth=32
+p reject 1-65535
+"""
+
+
+class TestBridgeNetworkStatusDocument(unittest.TestCase):
+  def test_empty_document(self):
+    """
+    Parse a document without any router status entries.
+    """
+
+    document = BridgeNetworkStatusDocument("published 2012-06-01 04:07:04")
+    self.assertEqual(datetime.datetime(2012, 6, 1, 4, 7, 4), document.published)
+    self.assertEqual((), document.routers)
+    self.assertEqual([], document.get_unrecognized_lines())
+
+  def test_document(self):
+    """
+    Parse a document with router status entries.
+    """
+
+    document = BridgeNetworkStatusDocument(DOCUMENT)
+    self.assertEqual(datetime.datetime(2012, 6, 1, 4, 7, 4), document.published)
+
+    self.assertEqual(2, len(document.routers))
+    self.assertEqual("Unnamed", document.routers[0].nickname)
+    self.assertEqual("TolFuin", document.routers[1].nickname)
+    self.assertEqual([], document.get_unrecognized_lines())

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