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

[tor-commits] [ooni-probe/master] Skip the oonicli tests if the user is not root.



commit 9962ae9bfc250498a9e3e6e82bdebed33140416c
Author: kudrom <kudrom@xxxxxxxxxx>
Date:   Mon Aug 4 19:32:56 2014 +0200

    Skip the oonicli tests if the user is not root.
    
    (cherry picked from commit ef773f81d322bd733a9c8f3c5aac31a48c785a01)
---
 ooni/tests/test_oonicli.py |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/ooni/tests/test_oonicli.py b/ooni/tests/test_oonicli.py
index c1c0615..92da134 100644
--- a/ooni/tests/test_oonicli.py
+++ b/ooni/tests/test_oonicli.py
@@ -8,6 +8,9 @@ from ooni.tests import is_internet_connected
 from ooni.tests.bases import ConfigTestCase
 from ooni.settings import config
 from ooni.oonicli import runWithDirector
+from ooni.utils import checkForRoot
+from ooni.errors import InsufficientPrivileges
+
 
 def verify_header(header):
     assert 'input_hashes' in header.keys()
@@ -57,6 +60,10 @@ class TestRunDirector(ConfigTestCase):
     def setUp(self):
         if not is_internet_connected():
             self.skipTest("You must be connected to the internet to run this test")
+        try:
+            checkForRoot()
+        except InsufficientPrivileges:
+            self.skipTest("You must be root to run this test")
         config.tor.socks_port = 9050
         config.tor.control_port = None
         self.filenames = ['example-input.txt']

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