[tor-commits] [stem/master] Using mock for event unit tests
atagar at torproject.org
atagar at torproject.org
Thu Jun 13 16:50:53 UTC 2013
commit f79278eec35de5520158923563256c45aa00f066
Author: Damian Johnson <atagar at torproject.org>
Date: Mon Jun 10 08:42:16 2013 -0700
Using mock for event unit tests
We don't really need a mock in this test, guess we do so to be more faithful to
the example.
---
test/unit/response/events.py | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/test/unit/response/events.py b/test/unit/response/events.py
index e41c80c..0d56309 100644
--- a/test/unit/response/events.py
+++ b/test/unit/response/events.py
@@ -10,6 +10,8 @@ import stem.response
import stem.response.events
import stem.util.log
+from mock import Mock
+
from stem import * # enums and exceptions
from test import mocking
@@ -340,10 +342,7 @@ class TestEvents(unittest.TestCase):
print_bw(_get_event("650 BW 15 25"))
time.sleep(0.05)
- controller = mocking.get_object(Controller, {
- 'authenticate': mocking.no_op(),
- 'add_event_listener': mocking.no_op(),
- })
+ controller = Mock(spec = Controller)
controller.authenticate()
controller.add_event_listener(print_bw, EventType.BW)
More information about the tor-commits
mailing list