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

[tor-commits] [stem/master] Fix interpreter unit tests



commit 073156e54b4f03c810ee5a0ca93df914bb3095b2
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Sat May 27 12:35:13 2017 -0700

    Fix interpreter unit tests
    
    Oops, prior change broke one of our assertions.
---
 test/unit/interpreter/commands.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/test/unit/interpreter/commands.py b/test/unit/interpreter/commands.py
index 020b14b..717614e 100644
--- a/test/unit/interpreter/commands.py
+++ b/test/unit/interpreter/commands.py
@@ -91,10 +91,15 @@ class TestInterpreterCommands(unittest.TestCase):
 
   def test_when_disconnected(self):
     controller = Mock()
-    controller.is_alive.return_value = False
+    controller.msg.side_effect = stem.SocketClosed('kaboom!')
 
     interpreter = ControlInterpreter(controller)
-    self.assertRaises(stem.SocketClosed, interpreter.run_command, '/help')
+
+    # we should be able to run non-tor commands
+    self.assertTrue('Interpreter commands include:' in interpreter.run_command('/help'))
+
+    # ... but tor commands should provide exceptions
+    self.assertRaises(stem.SocketClosed, interpreter.run_command, 'GETINFO version')
 
   def test_quit(self):
     interpreter = ControlInterpreter(CONTROLLER)



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