1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
# SPDX-License-Identifier: AGPL-3.0-or-later
"""
Tests for Tor Proxy module.
"""
from unittest.mock import patch
import pytest
from plinth.modules.torproxy import utils
class TestTorProxy:
"""Test cases for testing the Tor Proxy module."""
@staticmethod
@pytest.mark.usefixtures('needs_root')
def test_is_apt_transport_tor_enabled():
"""Test that is_apt_transport_tor_enabled does not raise any unhandled
exceptions.
"""
utils.is_apt_transport_tor_enabled()
@staticmethod
@patch('plinth.app.App.get')
@pytest.mark.usefixtures('needs_root', 'load_cfg')
def test_get_status(_app_get):
"""Test that get_status does not raise any unhandled exceptions.
This should work regardless of whether tor is installed, or
/etc/tor/instances/fbxproxy/torrc exists.
"""
utils.get_status()
|