File: test_torproxy.py

package info (click to toggle)
freedombox 26.3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 83,092 kB
  • sloc: python: 48,542; javascript: 1,730; xml: 481; makefile: 290; sh: 137; php: 32
file content (33 lines) | stat: -rw-r--r-- 885 bytes parent folder | download | duplicates (4)
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()