commit 58c48067ba1b901bdb1d4151181949591c97b60a Author: Sean Robinson seankrobinson@gmail.com Date: Fri Dec 14 16:12:28 2012 -0700
Add test case for invalid STATUS_* event type
Signed-off-by: Sean Robinson seankrobinson@gmail.com --- test/unit/response/events.py | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/test/unit/response/events.py b/test/unit/response/events.py index 21b5fa5..a632125 100644 --- a/test/unit/response/events.py +++ b/test/unit/response/events.py @@ -264,6 +264,9 @@ STATUS_SERVER_DNS_UP = "650 STATUS_SERVER NOTICE NAMESERVER_STATUS \ NS=205.171.3.25 \ STATUS=UP"
+# unknown STATUS_* event type +STATUS_SPECIFIC_CONSENSUS_ARRIVED = "650 STATUS_SPECIFIC NOTICE CONSENSUS_ARRIVED" + # STREAM events from tor 0.2.3.16 for visiting the google front page
STREAM_NEW = "650 STREAM 18 NEW 0 \ @@ -870,6 +873,12 @@ class TestEvents(unittest.TestCase):
self.assertEqual(expected_attr, event.keyword_args)
+ def test_status_event_bug(self): + # briefly insert a fake value in EVENT_TYPE_TO_CLASS + stem.response.events.EVENT_TYPE_TO_CLASS['STATUS_SPECIFIC'] = stem.response.events.StatusEvent + self.assertRaises(ValueError, _get_event, STATUS_SPECIFIC_CONSENSUS_ARRIVED) + del stem.response.events.EVENT_TYPE_TO_CLASS['STATUS_SPECIFIC'] + def test_stream_event(self): event = _get_event(STREAM_NEW)