tor: tests: Convert to pytest style tests from class based tests

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2024-02-15 10:33:45 -08:00 committed by James Valleroy
parent 37b9e21e30
commit 3aae4b39d6
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -11,13 +11,9 @@ from django.core.exceptions import ValidationError
from plinth.modules.tor import forms, utils from plinth.modules.tor import forms, utils
class TestTor: @patch('plinth.app.App.get')
"""Test cases for testing the Tor module.""" @pytest.mark.usefixtures('needs_root', 'load_cfg')
def test_get_status(_app_get):
@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. """Test that get_status does not raise any unhandled exceptions.
This should work regardless of whether tor is installed, or This should work regardless of whether tor is installed, or
@ -26,11 +22,7 @@ class TestTor:
utils.get_status() utils.get_status()
class TestTorForm: def test_bridge_validator():
"""Test whether Tor configration form works."""
@staticmethod
def test_bridge_validator():
"""Test upstream bridges' form field validator.""" """Test upstream bridges' form field validator."""
validator = forms.bridges_validator validator = forms.bridges_validator