[tor-commits] [stem/master] Add test cases for CIRC events

atagar at torproject.org atagar at torproject.org
Sat Dec 15 21:48:57 UTC 2012


commit c5db5cb1be07da0da92b30559557e72285d3fc37
Author: Sean Robinson <seankrobinson at gmail.com>
Date:   Fri Dec 14 15:00:49 2012 -0700

    Add test cases for CIRC events
    
    Check ProtocolError is raised when the TIME_CREATED time cannot be
    parsed or the CiruitID is not valid.
    
    Signed-off-by: Sean Robinson <seankrobinson at gmail.com>
---
 test/unit/response/events.py |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/test/unit/response/events.py b/test/unit/response/events.py
index 18ce4bd..47f4567 100644
--- a/test/unit/response/events.py
+++ b/test/unit/response/events.py
@@ -63,6 +63,16 @@ BUILD_FLAGS=NEED_CAPACITY \
 PURPOSE=GENERAL \
 TIME_CREATED=2012-11-08T16:48:38.417238"
 
+CIRC_LAUNCHED_BAD_1 = "650 CIRC 7 LAUNCHED \
+BUILD_FLAGS=NEED_CAPACITY \
+PURPOSE=GENERAL \
+TIME_CREATED=20121108T164838417238"
+
+CIRC_LAUNCHED_BAD_2 = "650 CIRC toolong8901234567 LAUNCHED \
+BUILD_FLAGS=NEED_CAPACITY \
+PURPOSE=GENERAL \
+TIME_CREATED=2012-11-08T16:48:38.417238"
+
 CIRC_EXTENDED = "650 CIRC 7 EXTENDED \
 $999A226EBED397F331B612FE1E4CFAE5C1F201BA=piyaz \
 BUILD_FLAGS=NEED_CAPACITY \
@@ -383,6 +393,9 @@ class TestEvents(unittest.TestCase):
     self.assertEqual(None, event.reason)
     self.assertEqual(None, event.remote_reason)
     
+    self.assertRaises(ProtocolError, _get_event, CIRC_LAUNCHED_BAD_1)
+    self.assertRaises(ProtocolError, _get_event, CIRC_LAUNCHED_BAD_2)
+    
     event = _get_event(CIRC_EXTENDED)
     
     self.assertTrue(isinstance(event, stem.response.events.CircuitEvent))





More information about the tor-commits mailing list