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

[tor-commits] [stem/master] Fixing incomplete mocking for protocolinfo unit test



commit 989fd953c6cf59deeaeb65a2a6fbde88d3410136
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Thu Mar 22 10:20:50 2012 -0700

    Fixing incomplete mocking for protocolinfo unit test
    
    The protocolinfo unit tests mock out system calls which should allow relative
    cookie paths to be expanded. However, this didn't account for the is_available
    checks which prevented those calls if the command was unavailable on the users
    system (for instance, OSX). Caught by gsathya.
---
 test/unit/connection/protocolinfo.py |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/test/unit/connection/protocolinfo.py b/test/unit/connection/protocolinfo.py
index c49e9bb..795d780 100644
--- a/test/unit/connection/protocolinfo.py
+++ b/test/unit/connection/protocolinfo.py
@@ -7,6 +7,8 @@ import unittest
 import stem.connection
 import stem.socket
 import stem.version
+import stem.util.proc
+import stem.util.system
 import test.mocking as mocking
 
 NO_AUTH = """250-PROTOCOLINFO 1
@@ -155,6 +157,8 @@ class TestProtocolInfoResponse(unittest.TestCase):
       elif command == stem.util.system.GET_CWD_PWDX % 10:
         return ["10: /tmp/foo"]
     
+    mocking.mock(stem.util.proc.is_available, mocking.return_false())
+    mocking.mock(stem.util.system.is_available, mocking.return_true())
     mocking.mock(stem.util.system.call, call_mocking)
     
     control_message = mocking.get_message(RELATIVE_COOKIE_PATH)

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