mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
Skip tor tests unless root.
This commit is contained in:
1 parent
66625c35a3
commit
90a1c334fe
1 file changed
+7
-1
@@ -19,19 +19,24 @@
|
||||
Tests for tor module.
|
||||
"""
|
||||
|
||||
import os
|
||||
import unittest
|
||||
|
||||
from ..tor import is_apt_transport_tor_enabled, get_hs, get_status
|
||||
euid = os.geteuid()
|
||||
if euid == 0:
|
||||
from ..tor import is_apt_transport_tor_enabled, get_hs, get_status
|
||||
|
||||
|
||||
class TestTor(unittest.TestCase):
|
||||
"""Test cases for testing the tor module."""
|
||||
@unittest.skipUnless(euid == 0, 'Needs to be root')
|
||||
def test_is_apt_transport_tor_enabled(self):
|
||||
"""Test that is_apt_transport_tor_enabled does not raise any unhandled
|
||||
exceptions.
|
||||
"""
|
||||
is_apt_transport_tor_enabled()
|
||||
|
||||
@unittest.skipUnless(euid == 0, 'Needs to be root')
|
||||
def test_get_hs(self):
|
||||
"""Test that get_hs does not raise any unhandled exceptions.
|
||||
|
||||
@@ -40,6 +45,7 @@ class TestTor(unittest.TestCase):
|
||||
"""
|
||||
get_hs()
|
||||
|
||||
@unittest.skipUnless(euid == 0, 'Needs to be root')
|
||||
def test_get_status(self):
|
||||
"""Test that get_status does not raise any unhandled exceptions.
|
||||
|
||||
|
||||
Reference in new issue
Block a user