tor: Fix test case for getting status

Mock the app so that it doesn't have to be loaded.

Closes: #1645.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2019-09-09 17:36:19 -07:00 committed by James Valleroy
parent 54b0e7c63b
commit 6db1926a62
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -18,6 +18,8 @@
Tests for Tor module.
"""
from unittest.mock import patch
import pytest
from django.core.exceptions import ValidationError
@ -36,8 +38,9 @@ class TestTor:
utils.is_apt_transport_tor_enabled()
@staticmethod
@patch('plinth.modules.tor.app')
@pytest.mark.usefixtures('needs_root', 'load_cfg')
def test_get_status():
def test_get_status(_app):
"""Test that get_status does not raise any unhandled exceptions.
This should work regardless of whether tor is installed, or